saadhamza
06-27-2009, 07:33 PM
ok, so here is the very basic code i wrote:
#include <iostream>
int main()
{
using namespace std;
int carrots;
cout << " how many carrots do u have? " << endl;
cin >> carrots;
cout << "here are a few more. keep 'em. " ;
carrots = carrots + 5;
cout << " now u have" << carrots << " carrots. " << endl;
cin.get();
return 0;
}
ok, so where it says cin.get(); in blue, i use that to keep the program open after i click enter so i can read what it says. but it still wont stay open long enough. any ideas why? and im useing a windows vista if that helps with microsoft visual studios express.
#include <iostream>
int main()
{
using namespace std;
int carrots;
cout << " how many carrots do u have? " << endl;
cin >> carrots;
cout << "here are a few more. keep 'em. " ;
carrots = carrots + 5;
cout << " now u have" << carrots << " carrots. " << endl;
cin.get();
return 0;
}
ok, so where it says cin.get(); in blue, i use that to keep the program open after i click enter so i can read what it says. but it still wont stay open long enough. any ideas why? and im useing a windows vista if that helps with microsoft visual studios express.