7 Replies - 249 Views - Last Post: 07 October 2012 - 11:12 PM Rate Topic: -----

#1 jstanga31  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 18
  • Joined: 07-October 12

i wrtten my code and it has compiled but it just is a black screen

Posted 07 October 2012 - 07:41 PM

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
	return 0;
}

#include <cstdio>  
#include <math.h>    
#include <iostream>  
using std::fixed;  

#include <iomanip>  
using std::setprecision;  

using namespace std;  

 double computeInterest(double dollars, int rate);  
 //returns the calculated interest.  

 void printEarning(double dollars, double interest);  
 //Displays the result.  

 int main()  

{  

double dollars, amount, interest, power, formularate;  
int years, rate;  
char response;  
bool notValid;  
int a=1;  
bool Repeat();  
while(1);  

{  

         cout << fixed << setprecision( 2 );  

do{  

notValid=false;   
cout << "\nEnter the Principal Value:" ;   
cin >> dollars;  

 if (dollars <10 || dollars >100000)  

       {  

       cout << "\nYou have entered invalid data";   
        notValid=true;  

         }  

    } while (notValid);  

   

   do {  

   notValid=false;   

   cout << "\nEnter the Interest Rate (in %):" ;  

    cin >> rate;  

    if (rate <.1 || rate > 99)  

       {  
         cout << "\nYou have entered invalid data";   

        notValid=true;  

      }  

   } while (notValid);  

   do {
    notValid=false;  

                                           

    cout << "\nEnter the time period (in years):" ;  

    cin >> years;  

  if (years<1 || years>100)  

       {  

        cout << "\nYou have entered invalid data";   

        notValid=true;  

       }  

   } while (notValid);  

      

   {  
	   notValid=false;

       cout << "\n\nYear     Beginning Balance     Interest Earned    Ending Balance";   

        cout << "\n------   -----------------     ---------------    ---------------\n";  

           

        for(a==1; a <= years;)  

                {   

                  formularate=(rate/100.0);  

                   amount = dollars * pow(1 + (formularate), (a) );  

               interest+=(amount-dollars);                 

                  cout << a;  

                  cout << "           ";    

                  cout << ((dollars));  

                cout << "               ";   
                   cout << interest;   

                  cout << "               ";   

                  cout << amount;    

                 cout << "               ";   

                  cout <<"\n\n";                    

                  a++;     

                 }  

                  cout << "Do you want to continue? (y/n) ";   

                 cin>>response;   
                 if ((response == 'N' || response == 'n'))  

                 return 0;   

                  if ((response == 'Y' || response == 'y'))  

                 {  

                   }  

                 }  

                 }  

         system("pause");  

        return 0;  

       }

This post has been edited by jimblumberg: 07 October 2012 - 08:07 PM
Reason for edit:: Added missing Code Tags, Please learn to use them.


Is This A Good Question/Topic? 0
  • +

Replies To: i wrtten my code and it has compiled but it just is a black screen

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 3989
  • View blog
  • Posts: 12,307
  • Joined: 25-December 09

Re: i wrtten my code and it has compiled but it just is a black screen

Posted 07 October 2012 - 08:08 PM

Do you by chance have a question or problem?

Jim
Was This Post Helpful? 0
  • +
  • -

#3 jstanga31  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 18
  • Joined: 07-October 12

Re: i wrtten my code and it has compiled but it just is a black screen

Posted 07 October 2012 - 08:14 PM

yes and i cant fix itt
Was This Post Helpful? 0
  • +
  • -

#4 jimblumberg  Icon User is offline

  • member icon


Reputation: 3989
  • View blog
  • Posts: 12,307
  • Joined: 25-December 09

Re: i wrtten my code and it has compiled but it just is a black screen

Posted 07 October 2012 - 09:01 PM

What is your question?

Jim
Was This Post Helpful? 0
  • +
  • -

#5 jstanga31  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 18
  • Joined: 07-October 12

Re: i wrtten my code and it has compiled but it just is a black screen

Posted 07 October 2012 - 09:06 PM

I keep getting these error messagesError messages: 'chp 4 working.exe': Loaded 'C:\Users\Owner\Documents\Visual Studio 2010\Projects\chp 4 working\Debug\chp 4 working.exe', Symbols loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\WRusr.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\urlmon.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\iertutil.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\wininet.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\normaliz.dll', Binary was not built with debug information.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\oleacc.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\secur32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\msimg32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Exports loaded.
'chp 4 working.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x12d4) has exited with code 1918107648 (0x72540000).
The thread 'Win32 Thread' (0x14fc) has exited with code -1073741510 (0xc000013a).
The program '[3940] chp 4 working.exe: Native' has exited with code -1073741510 (0xc000013a).



#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
return 0;

#include <cstdio>  
#include <math.h>    
#include <iostream>  
using std::fixed;  

#include <iomanip>  
using std::setprecision;  

using namespace std;  

 double computeInterest(double dollars, int rate);  
 //returns the calculated interest.  

 void printEarning(double dollars, double interest);  
 //Displays the result.  

 int main()  

{  

double dollars, amount, interest, power, formularate;  
int years, rate;  
char response;  
bool notValid;  
int a=1;  
bool Repeat();  
while(1);  

{  

         cout << fixed << setprecision( 2 );  

do{  

notValid=false;   
cout << "\nEnter the Principal Value:" ;   
cin >> dollars;  

 if (dollars <10 || dollars >100000)  

       {  

       cout << "\nYou have entered invalid data";   
        notValid=true;  

         }  

    } while (notValid);  

   

   do {  

   notValid=false;   

   cout << "\nEnter the Interest Rate (in %):" ;  

    cin >> rate;  

    if (rate <.1 || rate > 99)  

       {  
         cout << "\nYou have entered invalid data";   

        notValid=true;  

      }  

   } while (notValid);  

   do {
    notValid=false;  

                                           

    cout << "\nEnter the time period (in years):" ;  

    cin >> years;  

  if (years<1 || years>100)  

       {  

        cout << "\nYou have entered invalid data";   

        notValid=true;  

       }  

   } while (notValid);  

      

   {  
	   notValid=false;

       cout << "\n\nYear     Beginning Balance     Interest Earned    Ending Balance";   

        cout << "\n------   -----------------     ---------------    ---------------\n";  

           

        for(a==1; a <= years;)  

                {   

                  formularate=(rate/100.0);  

                   amount = dollars * pow(1 + (formularate), (a) );  

               interest+=(amount-dollars);                 

                  cout << a;  

                  cout << "           ";    

                  cout << ((dollars));  

                cout << "               ";   
                   cout << interest;   

                  cout << "               ";   

                  cout << amount;    

                 cout << "               ";   

                  cout <<"\n\n";                    

                  a++;     

                 }  

                  cout << "Do you want to continue? (y/n) ";   

                 cin>>response;   
                 if ((response == 'N' || response == 'n'))  

                 return 0;   

                  if ((response == 'Y' || response == 'y'))  

                 {  

                   }  

                 }  

                 }  

         system("pause");  

        return 0;  

       } 
]

This post has been edited by Salem_c: 07 October 2012 - 10:31 PM
Reason for edit:: added [code][/code] tags - learn to use them yourself

Was This Post Helpful? 0
  • +
  • -

#6 Salem_c  Icon User is online

  • void main'ers are DOOMED
  • member icon

Reputation: 1622
  • View blog
  • Posts: 3,080
  • Joined: 30-May 10

Re: i wrtten my code and it has compiled but it just is a black screen

Posted 07 October 2012 - 10:36 PM

> 035 while(1);
Yeah, this'll burn your CPU.

http://en.wikipedia....i/Infinite_loop

Your indentation needs work as well.
http://sourceforge.n...tle=Indentation

Oh, and your main is over 100 lines long, so now is a good time to think about some functions to split up the functionality into more manageable blocks.
Was This Post Helpful? 0
  • +
  • -

#7 jstanga31  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 18
  • Joined: 07-October 12

Re: i wrtten my code and it has compiled but it just is a black screen

Posted 07 October 2012 - 10:44 PM

can u help me with that im totally lost
Was This Post Helpful? 0
  • +
  • -

#8 Salem_c  Icon User is online

  • void main'ers are DOOMED
  • member icon

Reputation: 1622
  • View blog
  • Posts: 3,080
  • Joined: 30-May 10

Re: i wrtten my code and it has compiled but it just is a black screen

Posted 07 October 2012 - 11:12 PM

Well you could delete line 35 and see what happens....
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1