Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_pre.php on line 387

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_pre.php on line 387

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 337

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 339

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 341

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 343
help a c++ learning noobie :D

Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Feb 2007
    Posts
    32

    help a c++ learning noobie :D

    hello, i started learning c++, and i made a hello world but how do i need to save this and made this program work?? (i know bit of noobish )

  2. #2
    Site Admin xHalt's Avatar
    Join Date
    May 2006
    Location
    Belgium
    Posts
    8,202

    Re: help a c++ learning noobie :D

    Quote Originally Posted by graker
    hello, i started learning c++, and i made a hello world but how do i need to save this and made this program work?? (i know bit of noobish )
    Plz don't doublepost.
    Answer him here:
    http://cheatersutopia.com/smforum/in...17648#msg17648

    /closed

  3. #3
    Site Admin xHalt's Avatar
    Join Date
    May 2006
    Location
    Belgium
    Posts
    8,202

    Re: help a c++ learning noobie :D

    /reopened on request...

  4. #4
    Member
    Join Date
    Feb 2007
    Posts
    32

    Re: help a c++ learning noobie :D

    Code:
    // stringstreams
    #include <iostream>
    #include <string>
    #include <sstream>
    using namespace std;
    
    int main ()
    {
     string mystr;
     float price=0;
     int quantity=0;
    
     cout << "Enter price: ";
     getline (cin,mystr);
     stringstream(mystr) >> price;
     cout << "Enter quantity: ";
     getline (cin,mystr);
     stringstream(mystr) >> quantity;
     cout << "Total price: " << price*quantity << endl;
     return 0;
    }
    i have done this, i open it then there stand enter price: (fill in) then enter then enter quantity: (fill in again) then i push enter but the screen dissapears but the total price must appear :S how can i fix this?

    and btw
    Code:
    // my first c++ program
    
    #include <iostream>
    using namespace std;
    
    int main ()
    {
      cout << "Hello World!" ;
      cout << "what the fuck!" ;
      return 0;
    }
    if i start this only a black screen appears for less than a second how can i fix this?

    already thx for helping me

  5. #5
    Junior Member
    Join Date
    Sep 2006
    Posts
    3

    Re: help a c++ learning noobie :D

    Code:
    system("PAUSE");
    Try placing that before your&#39; ending curly brace ( } ).

  6. #6
    Senior Member
    Join Date
    Aug 2006
    Posts
    140

    Re: help a c++ learning noobie :D

    for the second part, the end should be

    cin.get ();
    }
    or something like that

  7. #7
    Junior Member
    Join Date
    Sep 2006
    Posts
    3

    Re: help a c++ learning noobie :D

    Same as system pause, both require user keypress to end the program. But you can use that i guess.

  8. #8
    Senior Member
    Join Date
    Mar 2007
    Posts
    140

    Re: help a c++ learning noobie :D

    This may even be better done without stringstreams and getline. Here let me show you.


    Code:
    #include <iostream>
    
    void main(void)
    {
     float fPrice=0;
     int nQuantity=0;
    
     cout << "Enter price: ";
     cin >> fPrice;
     cout << "\nEnter quantity: ";
     cin >> nQuantity;
     cout << "\nTotal price: " << fPrice*nQuantity << "\n";
     system("PAUSE");
    }

Similar Threads

  1. Learning to code
    By elephant in forum Basics
    Replies: 5
    Last Post: November 18th, 2011, 09:03
  2. I am learning C, I have questions
    By RaiZo in forum Basics
    Replies: 13
    Last Post: February 28th, 2011, 14:08
  3. Noobie!
    By LilHaCKER in forum Introduce Yourself
    Replies: 3
    Last Post: July 29th, 2010, 19:33
  4. [Learning c++] more than 60 C++ tutorial
    By Phobos in forum Basics
    Replies: 7
    Last Post: May 6th, 2010, 21:40
  5. please help the noobie
    By ru$$?ll in forum Enemy Territory Cheats
    Replies: 6
    Last Post: November 14th, 2006, 14:54

Bookmarks

Posting Permissions

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