Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 16th, 2006, 04:12 AM
Authorized User
 
Join Date: Oct 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mastrgamr
Default meaning of a warning

is there a place anywere that i can lookup wat each warning for a C++ means?(if that list isnt too big lol)

because i got a warning while compiling this:
----------------------------------------------------------------------
#include <iostream.h>

using namespace std;
int main()
{
    int age;
    cout<<"imma execute a program but first u have to be a certain age!\n";
    cout<<"enter ur age here: ";
    cin>> age;
    cin.ignore();
    if (age == 15) {
        cout<<"GOOD choice!\n";
        }
    else {
        cout<<"OOPS WRONG AGE!!!\n";
        }
cin.get();
return 0;

    int num;
    cout<<"Enterith anyith #(ith lol): ";
    cin>> num;
    cin.ignore();
    cout<<"U enteredith: "<< num<<"\n";
    cin.get();
}
----------------------------------------------------------------------
im not completley done i was just practicin my newbie skill. :D im tryna fix this code so wen i do enter the right age the program wont close how?

__________________
-Stuart Smith
Reply With Quote
  #2 (permalink)  
Old December 16th, 2006, 03:26 PM
Authorized User
 
Join Date: Oct 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mastrgamr
Default

i fixed the age problem! but still need hlp with the warnings...

Mŧ~|~®GÃ(v)R~
Reply With Quote
  #3 (permalink)  
Old December 17th, 2006, 06:40 AM
Authorized User
 
Join Date: Oct 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

helo mastrgamr
  i fixed your problem..
how did you fixed your problem?

you deleted the .h in iostream? coz try your code and it worked fined with me...

.::JHANNY::.

Reply With Quote
  #4 (permalink)  
Old December 17th, 2006, 01:06 PM
Authorized User
 
Join Date: Oct 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mastrgamr
Default

with my compiler i can use the .h extension and the regular iostream (without the extension) the problem i had was trying to close the programs when the wrong age is typed. (any age other than 15) but i fixed that.

Mŧ~|~®GÃ(v)R~
Reply With Quote
  #5 (permalink)  
Old December 18th, 2006, 08:27 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

Okay I'm a little lost in your question mastrgamr but I think you asked

how to keep the program from closing after you enter the right age?

Once the right age is entered where you typed your if statement

under good choice declare a variable as an int name it condition and give it a value of 1

create a while loop that runs while condition == 1

then inside of the loop give the user something to do

such as an input and if they enter x then it ends the loop

here is an example

int condition = 1;
char exitvar = 'a';
while (condition == 1)
{
     cout << "type x to leave\n";
     cin >> exitvar;
     if (exitvar == 'x')
     {
            condition = 0;
     }
     else
     {
            exitvar = 'a';
     }
}

~ Geo

~ Don't take life too seriously, you'll never get out alive!
Reply With Quote
  #6 (permalink)  
Old December 18th, 2006, 08:28 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

now this is obviously a bare bones example but you get the basic understanding right?

if you have anymore questions just ask

~ Geo

~ Don't take life too seriously, you'll never get out alive!
Reply With Quote
  #7 (permalink)  
Old December 21st, 2006, 01:16 PM
Authorized User
 
Join Date: Oct 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

in my case i put the
cin.get();
return 0;
 in order not to close if it is in right choice and put some comments like

 cout<< " press enter blah blah blah.....";

__________________________________________
.::If you quit you loss, If you survive you win::.

.::JHANNY::.

Reply With Quote
  #8 (permalink)  
Old December 22nd, 2006, 08:16 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

that is good but you should generally create a loop in case that for some reason they do not want to exit right away or if you come up with something that must be ddone before the exiting later.

~ Geo

~ Don't take life too seriously, you'll never get out alive!
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
meaning post and get amged Pro PHP 1 August 1st, 2007 06:33 AM
meaning of following Regular expressions buntyindia BOOK: Beginning Regular Expressions 0 June 25th, 2007 04:44 AM
Meaning Of MultiLanguage nir_pankaj C# 8 March 8th, 2007 01:10 PM
Meaning mani_he Beginning PHP 3 January 19th, 2005 12:26 AM
"p2p" what's meaning? shuicanyi Forum and Wrox.com Feedback 4 April 16th, 2004 12:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.