Advertisement

missing ; before {

Started by May 19, 2001 11:34 AM
3 comments, last by thomashun 23 years, 8 months ago
Whats going on peoples. I suck so please help a fellow programmer out. if (strcpy(Ohyeah.fienfive,"Stewart")) { cout<<"Stew: Hey "< Built to resist the test of time
get a book about c/c++, that code isn''t right in any way...
Advertisement
you must close every sentence that use character out that is 'cout' with ';', and you must use two '<<' and not one '<'.

for example...

cout << "C++ sux " << "big time!";

and not:

cout < "C++ rox " < "ahaa" //missing ;, and < must be <<

hope it helps, and get a girl


Edited by - ^cyer on May 19, 2001 12:58:16 PM
thomashun''s code got eaten because of HTML. You can see the full stuff by looking at the source, not quite as ridiculous as what is displayed here. The probably is that "else" requires an "if" to be used with a condition:

if (a_is_true())
do_a();
else if (b_is_true())
do_b();
else
do_something_else();

Also, since checking the result of strcpy (which copies strings) doesn''t quite make sense here, I''m going to guess that you really mean to compare strings, in which case strcmp is what you''re looking for. And remember, strcmp returns 0 if strings are equal so you need something such as: "if (0 == strcmp(a,b))"

I agree with the poster who recommends getting a book. There''s plenty of free stuff on the Internet that''ll get you started if you''re too cheap to buy a book.
Fucking A I just noticed like half the code got left off that is why it looks like complete shit.

This topic is closed to new replies.

Advertisement