When working on a program, I am getting this:
In funtion 'int main()'
61: Parse Error at end of input.
Can someone tell a new C++ user what the heck that means when I attempt to compile the program?
Printable View
When working on a program, I am getting this:
In funtion 'int main()'
61: Parse Error at end of input.
Can someone tell a new C++ user what the heck that means when I attempt to compile the program?
General syntax error, I think. Make sure all braces and parentheses are closed and that you didn't misspell any functions.
You may also have a stray character somewhere (such as a comma or something). It would help to see some of your code.
All parenthasies are closed. Functions are spelled right.
Yeah, these things can be elusive. Post your code, and we can help. Also make sure you don't have a semi-coloc (;) after the last brace. This is a mistake that I have seen made in the past.
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int num1, a1, b1, c1, d1, e1, subnum1;
cout << "Please enter a number: ";
cin >> num1;
subnum1 = num1;
while ( subnum1 > 9999 )
{
subnum1 = subnum1 - 1;
a1 = a1 + 1;
}
[this while loop is used a few more times]
cout << "your number is " << num1;
cout << "your integer is " << a1;
return 0;
}
This is just a little bit of my code.
You've used the >> operator for your final two output statements when you should use << with cout.
You've use a variable named subnum in your while loop have declared a variable called subnum1 (did you mean this).
a1 is never initialised so will contain junk when outputted.
These are the only things I can see that is wrong with the code you've posted (I don't know if these errors are in your original code or are as a result of cutting a bit out).
In your while loop, 'subnum' should presumably be 'subnum1' (unless it was declared in a piece of code not posted, then it is fine). Also, 'cout' uses the '<<' operator, not the '>>' operator.
Rats! You beat me by a minute zen. :)
Thank you for your input but the problems that you mention was my own dislexia from retyping the program here. In my program, the code errors you mention are that way in the program, it is just when I typed it here to show you, I was typing fast and had the fat finger problem.
> from retyping the program here
Well use the "Attach file:" feature at the bottom of the message compose window next time.
I appreciate the help, but I am using a Putty connection to the unix server at my school from home. Everything is done on the network and I am unable to use the windows cut, copy, paste method. (eliminates that cheating among students thing)
Anyways, Still unable to get the program to compile.
Thank you to all your help, going to go in and talk to a tutor at school tomorrow to see what I am doing wrong.