Results 1 to 9 of 9

Thread: Calculator using IOSTREAM

  1. #1

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Calculator using IOSTREAM

    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    string thename;
    float thenum;
    float thenum2;
    float thenum3;
    void addfunc(float a, float b,float c);
    
    int main()
    {
        cout<<"Welcome to the math world!!!\n\n\n\n"<<endl;
    	addfunc(thenum,thenum2,thenum3);
    	cout<<"\n\n\n\n*************HTTP://WWW.MERLINPAL.COM************\n\n"<<endl;
    
    	return 0;
    
    }
    
    void addfunc(float a,  float b,float c)
    {
    	cout<<"Number1\n"<<endl;
    	cin>>thenum;
    	cout<<"Number2\n"<<endl;
    	cin>>thenum2;
    	cout<<"Number3\n"<<endl;
    	cin>>thenum3;
    	a=thenum;
    	b=thenum2;
    	c=thenum3;
    	int thewhole=a+b+c;
    	cout<<"\n\n\nToltal:     "<<thewhole<<endl;
    }

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    So is there a problem or ...
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Thumbs up Writing Win32 APP.

    Hi, I'm an expert in VB, but I think I should move on to VC++ Win32 App.

    Can you send me an example that will Create a simple window(dialog)?

    Thanks a lot.

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  4. #4
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    look at the FAQ, or http://www.winprog.org

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  5. #5
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Parksie has a nice one...might be

    http://www.parksie.net/raw.zip

    I think that's it.

    whats wrong with your calculator?

  6. #6
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341

  7. #7
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Thats it! But I could never get it to work because my VC++ can't view English (UK) for some reason, only English (USA) you know how to fix that?

  8. #8

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Unhappy Parksie Doesn't work:(

    Parksie.net doesn't work...
    People can you guys look at this piece of code? It opens "d:\yuck.txt" to write in the string "username". But it doesn't work... Also when I enter the age, the email input is already doned....I mean please try this out and help me... I know you people are experts

    Code:
    #include <iostream>
    #include <string>
    #include <fstream>
    using namespace std;
    char username[200];
    int userage;
    char useremail[100];
    char userwebsite[100];
    char usersay[1000];
    
    void SEE_AGE();
    
    
    int main()
    {
    
    
    cout<<"HELLO, PLEASE TELL ME WHAT'S YOUR NAME:\n\n";
    cin.getline(username,200);
    cout<<"\n\nOK, "<<username<<". Please tell me how old are you?\n\n";
    cin>>userage;
    	if(userage>40){
    cout<<"\n\nYou are an old man, "<<username<<"!\n";
    	}
    else if(userage<10){
    		cout<<"\n\nWow, you are so young, "<<username<<"!\n";
    }
    else if (userage>80){
    		cout<<"\n\nAren't you a old folk? "<<username<<"!\n";
    }
    else{
    		cout<<"\n\nCool, you're "<<userage<<", "<<username<<"?\n";
    
    }
    
    cout<<"\n\n"<<username<<", your e-mail address?\n\n";
    cin.getline (useremail,100);
    cout<<"\n\n"<<username<<", what's your URL?\n\n";
    cin.getline (userwebsite,100);
    cout<<"\n\n"<<"Comments?\n\n";
    cin.getline (usersay,1000);
    
    ofstream the_FILE("d:\yuck.txt");
    if (!the_FILE.is_open()){
    	the_FILE<<"User Info:\n";
    	the_FILE<<username<< "\n\n";
    	the_FILE.close();
    }
    return 0;
    
    }
    
    
    
    void SEE_AGE()
    {
    	if(userage>40){
    cout<<"You are an old man, "<<username<<"!\n";
    	}
    else if(userage<10){
    		cout<<"Wow, you are so young, "<<username<<"!\n";
    }
    else if (userage>80){
    		cout<<"Aren't you a old folk? "<<username<<"!\n";
    }
    else{
    		cout<<"Cool, you're "<<userage<<", "<<username<<"?\n";
    }
    
    }

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width