hedzup456
Semi-poetic moron
- Joined
- Aug 5, 2012
- Messages
- 87
- Reaction score
- 0
- Points
- 0
- Location
- My LEO DGIV.
- Website
- mypoetryramblings.blogspot.co.uk
Hey all,
I've just started learning C++, and have made a program which has no issue when using
. However, I have seen that system("pause") is frowned apon-security backdoors, ect.
So I changed from system("pause") to
, and it now does not work.
Could someone please look through my code in a spare minute and check I haven't made any blatant errors causing this? My debugger doesnt pick anything up, but then....
(If it makes a difference, I am running Windows Seven Home Premium x64, my editor/compiler/debugger is Dev-C++ 4.9.9.2)
Here is my code:
Thanks in advance!
~Hedz
P.S. If I posted in the wrong area, please move and inform. Thanks!
I've just started learning C++, and have made a program which has no issue when using
Code:
system("PAUSE");
So I changed from system("pause") to
Code:
std::cin.get();
Could someone please look through my code in a spare minute and check I haven't made any blatant errors causing this? My debugger doesnt pick anything up, but then....
(If it makes a difference, I am running Windows Seven Home Premium x64, my editor/compiler/debugger is Dev-C++ 4.9.9.2)
Here is my code:
Code:
#include <iostream>
#include <cmath>
#include <limits>
#include <windows.h> //Allows 'sleep()'
//////////////////////////////////////////////////////////////////////////////////
// TODO: //
// re-set the counter in the Please Wait counter, //
// after lowering its number to speed up testing. //
//////////////////////////////////////////////////////////////////////////////////
int main()
{
using namespace std;
int variable;
cout << "What number do you want to test?" << endl;
cin >> variable;
cout << "Testing " << variable << " to see if it is bigger than 3..." << endl;
Sleep(2000); // Delay timer
system("CLS"); // Clear Screen
int i;
for (i=1;i<2;i++) //Loop for the dots!
{
cout << "Please Wait.";
//First (one dot)
Sleep(500);
//Pause for half a second
system("CLS");
//Clear screen
cout << "Please Wait..";
//Second (Two dots)
Sleep(500);
system("CLS");
cout << "Please Wait...";
//Third (three dots)
Sleep(500);
system("CLS");
// end of loop
}
system("CLS");
if (variable > 33) // If "variable" is less than 33
{
cout << variable << " is bigger than three!" << endl; // DO THIS
}
else if (variable % 2==0) //If "variable" is more than 33/if varibles modulo 2(remainder after dividiong by two) is zero, then do
{
cout << "Woah! " << variable << " is not bigger than 33, but is EVEN! Woah. That is DEEP, man!" << endl; // THIS!
}
else
{
cout << variable << " SUCKS! Its not even, its not more than thirty three... \nPick a better number next time!" << endl;
}
cout << "Press Enter to continue."; //'Press any key to continue'
std::cin.get();
return 0;
}
~Hedz
P.S. If I posted in the wrong area, please move and inform. Thanks!