| View previous topic :: View next topic |
| Author |
Message |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Tue Nov 13, 2007 8:44 pm Post subject: |
|
|
| TheSorc3r3r wrote: | Umm.. if you want to call main:
main();
Lol
btw, if you want to program GUIs, look at www.functionx.com/win32 |
That will eventually result in a stack overflow, so it is a horrible thing to do.
|
|
| Back to top |
|
 |
seeplusplus Grandmaster Cheater
Reputation: 0
Joined: 28 Oct 2007 Posts: 562 Location: cracking accounts
|
|
| Back to top |
|
 |
mOnSoOn Expert Cheater
Reputation: 0
Joined: 05 Jul 2007 Posts: 203
|
Posted: Tue Nov 13, 2007 9:57 pm Post subject: |
|
|
Ofcourse looping.
I think you should use the WHILE loop then you will do like this:
| Code: | int BackStay = 1;
While(BackStay==1) {
// -----code below-----
...
...
...
...
//When you want to back "Main"
//just increase or decrease BackStay.
// (BackMain++) then the While loop will break. or even use the break operator.
} |
|
|
| Back to top |
|
 |
M3KillU Grandmaster Cheater
Reputation: 0
Joined: 06 Apr 2007 Posts: 793 Location: California, USA
|
Posted: Wed Nov 14, 2007 9:18 am Post subject: |
|
|
| TheSorc3r3r wrote: | Umm.. if you want to call main:
main();
Lol
btw, if you want to program GUIs, look at www.functionx.com/win32 |
Thanks for the website.
Also... you can't call to "int main()" using
main();
It doesn't work. You can call void doing that. That is why I modified my script.
_________________
This is where my siggy goes! |
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Wed Nov 14, 2007 9:23 am Post subject: |
|
|
| M3KillU wrote: | Thanks for the website.
Also... you can't call to "int main()" using
main();
It doesn't work. You can call void doing that. That is why I modified my script. |
| Flyte wrote: | | That will eventually result in a stack overflow, so it is a horrible thing to do. |
|
|
| Back to top |
|
 |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Wed Nov 14, 2007 2:15 pm Post subject: |
|
|
| Flyte wrote: | | TheSorc3r3r wrote: | Umm.. if you want to call main:
main();
Lol
btw, if you want to program GUIs, look at www.functionx.com/win32 |
That will eventually result in a stack overflow, so it is a horrible thing to do. |
keyword being eventually =D
_________________
Don't laugh, I'm still learning photoshop! |
|
| Back to top |
|
 |
M3KillU Grandmaster Cheater
Reputation: 0
Joined: 06 Apr 2007 Posts: 793 Location: California, USA
|
Posted: Wed Nov 14, 2007 5:44 pm Post subject: |
|
|
I was saying it doesn't work... period...
My compiler won't let me do it.
How do you use an if comparison to see if someone typed a text you wanted?
like...
| Code: |
void question()
{
int answer;
cout << "\n\nWhat language do most Americans speak?\n";
cin >> answer;
if (answer /*English*/) {
cout << "Whatever....\n\n";
}
else {
cout << "Loser, try again."
question();
}
int main()
{
question();
return 0;
system("PAUSE");
}
|
________________________________
Does anyone know how to make it not close out after you are done? Like how it will prompt you to "press any key to continue..."
_________________
This is where my siggy goes! |
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Wed Nov 14, 2007 5:56 pm Post subject: |
|
|
| M3KillU wrote: | I was saying it doesn't work... period...
My compiler won't let me do it.
How do you use an if comparison to see if someone typed a text you wanted? |
strcmp()/stricmp() (_tcsicmp() if you use <tchar.h>)
| M3KillU wrote: | | Does anyone know how to make it not close out after you are done? Like how it will prompt you to "press any key to continue..." |
| Code: | std::cin.sync();
std::cin.get(); |
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Wed Nov 14, 2007 5:57 pm Post subject: |
|
|
M3KillU:
| Code: |
#include <iostream>
#include <string>
void question()
{
std::string answer;
std::cout << std::endl << std::endl;
std::cout << "What language do most Americans speak?" << std::endl;
std::cin >> answer;
if (answer == "English") {
std::cout << "Whatever...." << std::endl << std::endl;
} else {
std::cout << "Loser, try again.";
question();
}
}
int main(int argc, char* argv[])
{
question();
return 0;
}
|
_________________
|
|
| Back to top |
|
 |
M3KillU Grandmaster Cheater
Reputation: 0
Joined: 06 Apr 2007 Posts: 793 Location: California, USA
|
|
| Back to top |
|
 |
|