Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 26th, 2005, 11:24 PM   #11
nindoja
Programmer
 
Join Date: Jun 2005
Posts: 92
Rep Power: 4 nindoja is on a distinguished road
Here is what you need to do:
cin >> i
This will keep the window open to see the results. Or, if you know that your OS has a "PAUSE" command, you can do the following:
[code]#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
......
cout << endl;
system("PAUSE");
return 0;
}
nindoja is offline   Reply With Quote
Old Oct 27th, 2005, 3:05 AM   #12
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
That code looks fine to me, try putting in this code, before return 0;

cout<<"Type Q to quit";
cin.get();
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Oct 27th, 2005, 5:59 AM   #13
nindoja
Programmer
 
Join Date: Jun 2005
Posts: 92
Rep Power: 4 nindoja is on a distinguished road
ahhhhhhhhhh, don't post late at night.... sorry, I forgot to close the code thingy.
nindoja is offline   Reply With Quote
Old Oct 27th, 2005, 3:10 PM   #14
D-Ferg27
Programmer
 
D-Ferg27's Avatar
 
Join Date: Oct 2005
Posts: 49
Rep Power: 0 D-Ferg27 is on a distinguished road
grrrrrrr WTF is wrong im starting to get pissed :mad:

#include <iostream>
int main()
using namespace std;

{
    int i;
    cout << "please enter an integer value: ";
    cin >> i;
    cout << " \n the value you entered is" << i;
    cout << "and its double is...\n ";
    cout << i*2;
    return 0;
}
D-Ferg27 is offline   Reply With Quote
Old Oct 27th, 2005, 3:13 PM   #15
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
What is happenning that you don't want?
What errors are you getting, if any?
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Oct 27th, 2005, 3:15 PM   #16
D-Ferg27
Programmer
 
D-Ferg27's Avatar
 
Join Date: Oct 2005
Posts: 49
Rep Power: 0 D-Ferg27 is on a distinguished road
Im starting to think that the tutorial sucks balls. It wont even compile :mad:
D-Ferg27 is offline   Reply With Quote
Old Oct 27th, 2005, 3:18 PM   #17
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
As i said before, what errors do you get when compiling?
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Oct 27th, 2005, 3:24 PM   #18
D-Ferg27
Programmer
 
D-Ferg27's Avatar
 
Join Date: Oct 2005
Posts: 49
Rep Power: 0 D-Ferg27 is on a distinguished road
#include <iostream>
int main()


{
    int i ;
    cout << "please enter an integer value: " ;     //Cout undeclared (first use              
                                                                 // this function)
    cin >> i;                                                  
    cout << " \n the value you entered is" << i;
    cout << "and its double is...\n ";
    cout << i * 2;
    return 1;
}

ok when i try to compile it it just does nothing then highlight the ling that i put the comment in and says waht i put in the comment.
D-Ferg27 is offline   Reply With Quote
Old Oct 27th, 2005, 3:26 PM   #19
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
put in : using namespace std;

and replace return 1; with return 0;
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Oct 27th, 2005, 3:27 PM   #20
D-Ferg27
Programmer
 
D-Ferg27's Avatar
 
Join Date: Oct 2005
Posts: 49
Rep Power: 0 D-Ferg27 is on a distinguished road
now it highlight the using namespace std; line in red.
D-Ferg27 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:28 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC