944,043 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2547
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 19th, 2006
0

Help with a problem with C++ program

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tln26 is offline Offline
9 posts
since Aug 2006
Aug 19th, 2006
0

Re: Help with a problem with C++ program

Show your code and what compiler you use?
Reputation Points: 197
Solved Threads: 12
Junior Poster
Grunt is offline Offline
147 posts
since Jul 2006
Aug 19th, 2006
0

Re: Help with a problem with C++ program

> 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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 19th, 2006
0

Re: Help with a problem with C++ program

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

Quote 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tln26 is offline Offline
9 posts
since Aug 2006
Aug 19th, 2006
0

Re: Help with a problem with C++ program

I modified your first code. There were quite a number of errors in them.
C++ Syntax (Toggle Plain Text)
  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.
Reputation Points: 197
Solved Threads: 12
Junior Poster
Grunt is offline Offline
147 posts
since Jul 2006
Aug 19th, 2006
0

Re: Help with a problem with C++ program

Regarding your second code:
Each string literal must appear entirely on one line of the program.
Reputation Points: 197
Solved Threads: 12
Junior Poster
Grunt is offline Offline
147 posts
since Jul 2006
Aug 19th, 2006
0

Re: Help with a problem with C++ program

> 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
C++ Syntax (Toggle Plain Text)
  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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 19th, 2006
0

Re: Help with a problem with C++ program

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tln26 is offline Offline
9 posts
since Aug 2006
Aug 20th, 2006
0

Re: Help with a problem with C++ program

Click on QUICK REPLY or ADVANCED REPLY and see the background image.
Reputation Points: 197
Solved Threads: 12
Junior Poster
Grunt is offline Offline
147 posts
since Jul 2006
Aug 20th, 2006
0

Re: Help with a problem with C++ program

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

C++ Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tln26 is offline Offline
9 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: VC++ problem agian
Next Thread in C++ Forum Timeline: Float Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC