Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

C++ programming problem(novice)


ghost's Avatar
0 0

Thanks!


ghost's Avatar
0 0

sharpskater80 wrote: First part is easy, just look up basic input stuff. Second part, there is a goto keyword that does what you want.

if ( condition_is_met )
goto point_in_program;```

http://www.dreamincode.net/forums/showtopic38912.htm could help


:o...that was a joke right?

ghost's Avatar
0 0

To make a note, use getline(cin,input) rather than cin>>input because cin>>input will terminate whenever a whitespace is encountered.


hellboundhackersok's Avatar
Banned
0 0

DON'T USE GOTO!!!… Well… that's what I was taught…


ghost's Avatar
0 0

Stop bumping this thread, it's old.


yours31f's Avatar
Retired
10 0

#include <iostream> using namespace std; int main{ char Hello [5]; cin >> Hello; if (hello == hello) cout << "Good!" << endl; else cout << "Why not?"; }

so the program makes you type hello then it says good or why not, based on what you typed.


ghost's Avatar
0 0

yours31f wrote: #include <iostream> using namespace std; int main{ char Hello [5]; cin >> Hello; if (hello == hello) cout << "Good!" << endl; else cout << "Why not?"; }

so the program makes you type hello then it says good or why not, based on what you typed.

C++ is case sensitive, so 'hello' isn't the same as 'Hello'. And probably you want to do 'if(Hello == "hello")' ;)

And the main function should return some value.