| View previous topic :: View next topic |
| Author |
Message |
saintpat123 Cheater
Reputation: 0
Joined: 15 Jan 2007 Posts: 29 Location: In my room. Or in yours?
|
Posted: Thu Apr 03, 2008 8:35 pm Post subject: I would like some 'guidance' on what I'm working on. |
|
|
Hi my friend and I are currently trying to learn C++. Now I just made a couple of little programs and I was just curious as to how I could make a GUI for some of them? If anyone could help I would be much abliged. Thank you in advance.
_________________
Heh I just owned j00  |
|
| Back to top |
|
 |
Travis13 Expert Cheater
Reputation: 0
Joined: 17 Feb 2007 Posts: 199
|
Posted: Thu Apr 03, 2008 8:37 pm Post subject: |
|
|
im his friend and we basically wanna know how to make a gui from a simple source, he will include our source in a second
EDIT: this is it
| Code: | #include "main.h"
#include <iostream>
using namespace std;
int main(void)
{
system("TITLE The Battle!");
system("COLOR 5");
char cInput;
cout << "Maplestory Owns!" << endl;
cout << "Is this true? (y or n)" << endl;
cin >> cInput;
if(cInput == 'Y'||cInput == 'y')
cout << "You are totally correct!" << endl;
else
cout << "YEAH!" << endl;
system("PAUSE");
return 0;
}
main::~main(void)
{
}
|
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Thu Apr 03, 2008 9:52 pm Post subject: |
|
|
| First of all, that looks like it would be a console prog. Use createwindowEX.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Apr 04, 2008 6:14 am Post subject: |
|
|
| Travis13 wrote: | im his friend and we basically wanna know how to make a gui from a simple source, he will include our source in a second
EDIT: this is it
| Code: | #include "main.h"
#include <iostream>
using namespace std;
int main(void)
{
system("TITLE The Battle!");
system("COLOR 5");
char cInput;
cout << "Maplestory Owns!" << endl;
cout << "Is this true? (y or n)" << endl;
cin >> cInput;
if(cInput == 'Y'||cInput == 'y')
cout << "You are totally correct!" << endl;
else
cout << "YEAH!" << endl;
system("PAUSE");
return 0;
}
main::~main(void)
{
}
|
|
Some suggestions:
- Ditch main.h (you really don't need it for this.)
- Delete the main::~main(void) deconstructor, don't need it either.
- Remove 'using namespace std;' and just use std:: infront of the iostream members.
- Don't use system("pause") to pause the console, firstly, it wastes resources and loads things into the memory of your program that you doesn't need. Instead, you can already use whats given to you in the iostream header:
| Code: | std::cin.sync();
std::cin.ignore(); |
_________________
- Retired. |
|
| Back to top |
|
 |
saintpat123 Cheater
Reputation: 0
Joined: 15 Jan 2007 Posts: 29 Location: In my room. Or in yours?
|
Posted: Fri Apr 04, 2008 3:47 pm Post subject: |
|
|
ok I am sorry but me and my friend are BRAND new to C++ I understand everything you said except what do std::cin.sync(); and std::cin.ignore(): exactly do?
_________________
Heh I just owned j00  |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
|
| Back to top |
|
 |
|