STILL NEED HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Im having some trouble with a program ive been trying to make.
I need to compile this: Code:
using namespace std; Code:
tux@localhost tux $ g++ ex12.cpp |
oh...
|
Code:
#include <iostream> Code:
tux@localhost tux $ g++ ex12.cpp |
try
Code:
#include <iostream> |
// sequence is a comment, no?
|
I have your answer...
I tried to include my own version of your fixed source, but everytime i previewed my post...the code's formatting was lost and yes, i did try to include it as code. So when I refer to a line number, count down your code - with the first include being line #1.
The first fix was on line #14, the smile was confusing the compiler. You see, on the first try you entered in \__/ which translates to the escape sequence \_ (which doesnt exist) followed by underscores and finally a / . This is not what you wanted. So in order to include a \ character into a string statement you need to use the escape sequence \\ which translates into a single \ . That takes care of the smile, next we tackle the "syntax error before string constant" error. That error is on line # 17. You had this: cout << " "happy" " << endl; what you wanted was the word happy with quotes, with white space on both sides. But when the compiler sees this, it thinks happy is a variable since it is outside of the two sets of quotes! It thinks you meant this: cout <<" " << happy << " " << endl ; But you just goofed up and didnt put that other <<operator in! What you needed were two \" escape sequences before and after the happy to print two quotes and not end your string. I hope this helps! :cool: |
oops
Seems like someone already answered the question!
Oh well. |
Never cared for the smiley face algorithm's i've seen, in book's nor in actual code, for me, despite the many book's, which, in fact, had little to do with smiley face's, never gave me a sense of tightness that i was looking for in smiley face code, oh we'll. :D
|
if by tightness you mean compactness then how about this
Code:
#include <iostream> |
I try to compile your code, kev82, and it gives me this.
Code:
smile.cpp: In function `int main()': |
you must have quite a pedantic compiler, on line 9 put ll after the hex number, ie
Code:
if((long long)1<<bit & 0x81006600423c0081ll) |
Yes, my compiler is gcc 3.3. I added ll and it works now.
|
Quote:
Code:
int main(int argc, argv*) |
All times are GMT -5. The time now is 04:49 AM. |