Help with a problem with C++ program

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2006
Posts: 9
Reputation: tln26 is an unknown quantity at this point 
Solved Threads: 0
tln26 tln26 is offline Offline
Newbie Poster

Help with a problem with C++ program

 
0
  #1
Aug 19th, 2006
I am very new the C++ with no programming background. I have written a program to figure out the interest on a 401K plan. I wrote the program and tried to run it and I keep getting a message that there is not an exe. file. What is causing this?
The first few program I wrote I did not have this problem, but the last 3 I have written I keep getting this message.

Any support on this is appreciated.....
Thanks,
Tina
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 147
Reputation: Grunt has a spectacular aura about Grunt has a spectacular aura about 
Solved Threads: 12
Grunt's Avatar
Grunt Grunt is offline Offline
Junior Poster

Re: Help with a problem with C++ program

 
0
  #2
Aug 19th, 2006
Show your code and what compiler you use?
The key to eliminating bugs from your code is learning from your mistakes.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Help with a problem with C++ program

 
0
  #3
Aug 19th, 2006
> I keep getting a message that there is not an exe. file. What is causing this?
Exact details please, not some vague "there's an error".
This means
- State your OS and compiler, with versions (not just windows and borland say)
- An example simple program which shows the problem - don't forget the code tags
- copy / paste any error messages you get.

Most compilers for example will not produce a .exe file if there are errors in your prog.cpp file.
So my guess is, is that it isn't compiling.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 9
Reputation: tln26 is an unknown quantity at this point 
Solved Threads: 0
tln26 tln26 is offline Offline
Newbie Poster

Re: Help with a problem with C++ program

 
0
  #4
Aug 19th, 2006
I am using windows XP.
The program is Microsoft Visual Studio.Net 2003
Unable to start debugging system could not find the exe.file.
Error:
C2109
Fatal Error:
C1075

Here is the first one:


// 3P1.cpp : Defines the entry point for the console application.
//Program Documentation:
// Name : <YOUR NAME>
// Date : <Date File was created>
// Description : Assignment 3 – Problem 1: Going Loopy
// Assignment/Problem : A3P1
// File Name : <Your User Name>A3P1.cpp
// Course : Intro to C++ CS2244
// Instructor : Raymond Welch

#include <iostream>
#include "stdafx.h"
using std::cin;
using std::cout;
using std::endl;


int _tmain(int argc, _TCHAR* argv[])
{
char ch=0;
int years=0;
int worth=0;

cout<<endl;


do{
cout<< "Enter the number of years you have worked \n";
cin>>years;
worth=1000[1+(.04*years)];

cout<< "Do you want to figure another number of years worked? (y/n): ";
cin>>ch;
cout<<endl;
} while (ch=='y');

{cout<< "Your 401K is now worth $";
cin>>worth;
cout<<endl;



return 0;
}

Here is the second one:

Unable to start debugging system could not find exe.file
Error: C2109
Fatal Error: C1075

// 3 2.cpp : Defines the entry point for the console application.
//#include "stdafx.h"
#include <iostream>
using std::cin;
using std::cout;
using std::endl;


int _tmain(int argc, _TCHAR* argv[])
{int sum=0;
int count=0;

cout<< "This program will take any number you enter,/n then it will add all numbers leading up to this number /n
to include the number giving you the sum./n Please enter a number";
cin>>count;

for(int i=1;i<=count;i++)
sum+=i;

cout<<endl
<<"The sum of the numbers 1 to "<<count
<<"is "<<sum<<endl;

return 0;
}

I hope this is what you were needing.....
If not, please let me know.
Thanks for your help!
T

Originally Posted by Salem
> I keep getting a message that there is not an exe. file. What is causing this?
Exact details please, not some vague "there's an error".
This means
- State your OS and compiler, with versions (not just windows and borland say)
- An example simple program which shows the problem - don't forget the code tags
- copy / paste any error messages you get.

Most compilers for example will not produce a .exe file if there are errors in your prog.cpp file.
So my guess is, is that it isn't compiling.
Last edited by tln26; Aug 19th, 2006 at 9:13 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 147
Reputation: Grunt has a spectacular aura about Grunt has a spectacular aura about 
Solved Threads: 12
Grunt's Avatar
Grunt Grunt is offline Offline
Junior Poster

Re: Help with a problem with C++ program

 
0
  #5
Aug 19th, 2006
I modified your first code. There were quite a number of errors in them.
  1. #include <iostream>
  2.  
  3. using std::cin;
  4. using std::cout;
  5. using std::endl;
  6.  
  7.  
  8. int main(int argc, char* argv[])
  9. {
  10. char ch=0;
  11. int years=0;
  12. int worth=0;
  13.  
  14. cout<<endl;
  15.  
  16.  
  17. do{
  18. cout<< "Enter the number of years you have worked \n";
  19. cin>>years;
  20.  
  21. worth=1000*(1+.04*years);
  22.  
  23. cout<< "Do you want to figure another number of years worked? (y/n): ";
  24. cin>>ch;
  25. cout<<endl;
  26. }
  27. while (ch=='y');
  28. {
  29. cout<< "Your 401K is now worth $";
  30. cout<<worth;
  31. cout<<endl;
  32. }
  33.  
  34. return 0;
  35. }


1) Changed worth=1000[1+(.04*years)]; to worth=1000*(1+.04*years);
Why were you using [ ] here?

2) Changed cin>>worth; to cout<<worth. You purpose is to output it to output stream. So, you need cout not cin.

3) There was a missing closing brace } of while. Braces are always even in number.
The key to eliminating bugs from your code is learning from your mistakes.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 147
Reputation: Grunt has a spectacular aura about Grunt has a spectacular aura about 
Solved Threads: 12
Grunt's Avatar
Grunt Grunt is offline Offline
Junior Poster

Re: Help with a problem with C++ program

 
0
  #6
Aug 19th, 2006
Regarding your second code:
Each string literal must appear entirely on one line of the program.
The key to eliminating bugs from your code is learning from your mistakes.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Help with a problem with C++ program

 
0
  #7
Aug 19th, 2006
> don't forget the code tags
I guess that fell on deaf ears.

And I guess you don't see the background image of the edit window where you compose your messages, which also tells you about the code tags.

Programming is about attention to detail.

Press "compile" every few lines, not when the whole program is done. That way you're only ever a few edits between your last good program and the current crop of error messages.

> Each string literal must appear entirely on one line of the program.
The compiler will fold long lines like this example
  1. cout << "This is an example"
  2. " of text spread over"
  3. " many lines\n";
Last edited by Salem; Aug 19th, 2006 at 9:57 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 9
Reputation: tln26 is an unknown quantity at this point 
Solved Threads: 0
tln26 tln26 is offline Offline
Newbie Poster

Re: Help with a problem with C++ program

 
0
  #8
Aug 19th, 2006
Thank you for your assistance. Using formulas keeps me guessing. In switching math formulas into computer formulas I never know what () to use and when * is needed for multiplication instead of using ().

I have one more question for you......

I know this sounds stupid, but it shows just how green I am....

What are code tags and where should they be included??

Thanks again for your help......
T
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 147
Reputation: Grunt has a spectacular aura about Grunt has a spectacular aura about 
Solved Threads: 12
Grunt's Avatar
Grunt Grunt is offline Offline
Junior Poster

Re: Help with a problem with C++ program

 
0
  #9
Aug 20th, 2006
Click on QUICK REPLY or ADVANCED REPLY and see the background image.
The key to eliminating bugs from your code is learning from your mistakes.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 9
Reputation: tln26 is an unknown quantity at this point 
Solved Threads: 0
tln26 tln26 is offline Offline
Newbie Poster

Re: Help with a problem with C++ program

 
0
  #10
Aug 20th, 2006
Unable to start debugging system could not find exe.file
Error: C2109
Fatal Error: C1075

  1. // 3 2.cpp : Defines the entry point for the console application.
  2. //#include "stdafx.h"
  3. #include <iostream>
  4. using std::cin;
  5. using std::cout;
  6. using std::endl;
  7.  
  8.  
  9. int _tmain(int argc, _TCHAR* argv[])
  10. {int sum=0;
  11. int count=0;
  12.  
  13. cout<< "This program will take any number you enter,/n then it will add all numbers leading up to this number /n
  14. to include the number giving you the sum./n Please enter a number";
  15. cin>>count;
  16.  
  17. for(int i=1;i<=count;i++)
  18. sum+=i;
  19.  
  20. cout<<endl
  21. <<"The sum of the numbers 1 to "<<count
  22. <<"is "<<sum<<endl;
  23.  
  24. return 0;
  25. }


I hope this is what you were needing.....
If not, please let me know.
Thanks for your help!
T
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC