Thread: Simple question regarding variables

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    #include <me!> Flakster's Avatar
    Join Date
    May 2005
    Location
    Canada
    Posts
    50
    Code:
    // stupid libs
    
    #include <string>
    #include <iomanip.h>
    #include <iostream>
    
    int choice;
    
    using std::string;
    
    void intro()
    {
    	cout<<"                     ------------Stupid Libs v1.0------------"<<endl<<endl;
    	system("pause");
    	cout<<" "<<endl;
    	cout<<"You will be prompted for various types of words, \ninput them or suffer a punch in your crappy face."<<endl<<endl;
    	system("pause");
    	cout<<" "<<endl;
    	cout<<"First... lets go over the basics, just incase you forgot that garbage already."<<endl;
    }
    
    void words()
    {
    	cout<<" "<<endl;
    	system("pause");
    	cout<<"			Parts of Speech"<<endl;
    	cout<<" "<<endl;
    	cout<<"Noun:  A person, place or thing."<<endl;
    	cout<<" "<<endl<<endl;
    	cout<<"Proper Noun:  A paticular thing, event, or a \nname of a person.  Often capitalized."<<endl;
    	cout<<" "<<endl<<endl;
    	cout<<"Pronoun:  Indicate the subject of the sentence, \nsuch as it, he, her, we or they."<<endl;
    	cout<<" "<<endl<<endl;
    	cout<<"Adjective:  Describes or modifies a noun, often \nhas a suffixe such as -able, -ous, -er, or -est."<<endl;
    	cout<<" "<<endl<<endl;
    	cout<<"Verb:  An action, such as run, jump or take."<<endl;
    	cout<<" "<<endl<<endl;
    	cout<<"Adverb:  Describes or modifies a verb, such as \nvery, rapidly or unrelentlessly."<<endl;
    	cout<<"\n"<<endl;
    	system("pause");
    }
    
    void libchoice()
    {
    	cout<<"\n\n\n\n\n\n\n\n\n"<<endl;
    	cout<<"Choose lib 1, 2 or 3."<<endl;
    	cout<<" "<<endl;
    	cout<<"Input lib choice now: ";
    	cout<<"\n\n\n\n\n\n\n\n\n\n"<<endl;
    	cin>>choice;
    
    	cout<<" "<<endl;
    }
    
    void liba()
    {
    
    	string a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r;
    
    cout<<"Adjective : ";
    cin>>a;
    cout<<""<<endl;
    cout<<"Adjective : ";
    cin>>b;
    cout<<""<<endl;
    cout<<"Adjective : ";
    cin>>c;
    cout<<""<<endl;
    cout<<"Adjective : ";
    cin>>d;
    cout<<""<<endl;
    cout<<"Liquid : ";
    cin>>e;
    cout<<""<<endl;
    cout<<"Noun : ";
    cin>>f;
    cout<<""<<endl;
    cout<<"Noun : ";
    cin>>g;
    cout<<""<<endl;
    cout<<"Noun : ";
    cin>>h;
    cout<<""<<endl;
    cout<<"Noun : ";
    cin>>i;
    cout<<""<<endl;
    cout<<"Noun : ";
    cin>>j;
    cout<<""<<endl;
    cout<<"Noun : ";
    cin>>k;
    cout<<""<<endl;
    cout<<"Noun : ";
    cin>>l;
    cout<<""<<endl;
    cout<<"Noun : ";
    cin>>m;
    cout<<""<<endl;
    cout<<"Number : ";
    cin>>n;
    cout<<""<<endl;
    cout<<"Plural Noun : "; 
    cin>>o;
    cout<<""<<endl;
    cout<<"Plural Noun : ";
    cin>>p;
    cout<<""<<endl;
    cout<<"Plural Noun : ";
    cin>>q;
    cout<<""<<endl;
    cout<<"Plural Noun : ";
    cin>>r;
    cout<<""<<endl;
    system("pause");
    cout<<""<<endl;
    cout<<"            Proverbs"<<endl;
    cout<<"Too many "<<o<<" spoil the "<<e<<"."<<endl; 
    
    cout<<"People who live in "<<a<<" houses shouldn't throw "<<p<<"."<<endl; 
    
    cout<<"The shortest distance between two "<<q<<" is a straight "<<6<<"."<<endl;
    
    cout<<"Love of "<<r<<" is the root of all evil."<<endl; 
    
    cout<<"A "<<b<<" stone gathers no "<<g<<"."<<endl;
    
    cout<<"A "<<h<<" a day keeps the "<<i<<" away."<<endl; 
    
    cout<<"A "<<j<<" in time saves "<<n<<"."<<endl;
    
    cout<<"You can't keep a "<<c<<" man down."<<endl; 
    
    cout<<"You can't teach a "<<d<<" "<<k<<" new tricks."<<endl; 
    
    cout<<"The way to a man's "<<l<<" is through his "<<m<<"."<<endl;
    }
    
    void libb()
    {
    	cout<<"Lib b"<<endl;
    }
    
    void libc()
    {
    	cout<<"Lib c"<<endl;
    }
    
    void main()
    {
    
    	for (int run=0; run < 1; run++)
    	{
    	intro();
    	words();
    	libchoice();
    		if (choice == 1)
    			liba();
    		else if (choice == 2)
    			libb();
    		else if (choice == 3)
    			libc();
    		else
    			cout<<"Invalid choice, please pick between 1, 2 or 3."<<endl;
    			libchoice();
    
    	}
    }
    Sorry, theres what I have.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Add these as well:
    Code:
    using std::cin;
    using std::cout;
    using std::endl;
    Or alternately you can include standard namespace:
    Code:
    using namespace std;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Question!!
    By gameuser in forum C++ Programming
    Replies: 2
    Last Post: 06-06-2009, 05:42 PM
  2. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 12:15 PM
  3. simple question about variables and loops
    By InvariantLoop in forum C Programming
    Replies: 2
    Last Post: 01-26-2005, 09:47 AM
  4. Data Storage Question, and Dynamic variables?
    By Zeusbwr in forum C++ Programming
    Replies: 5
    Last Post: 10-21-2004, 11:01 PM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM