quick question

This is a discussion on quick question within the C++ Programming forums, part of the General Programming Boards category; im sorry to keep bugging you but i have one more problem? am i not doing the math right because ...

  1. #16
    Registered User
    Join Date
    Nov 2001
    Posts
    255
    im sorry to keep bugging you but i have one more problem? am i not doing the math right because the variables that are constant arent being ammounted to what they should be for example:

    software is 69.95 and mem_card is 34.98 while both nw_pc and disk_drive are 69.95

    but if u look at the code you see this is clearly not supposed to be. i know its something ive overlooked but im not sure what? any ideas?
    hooch

  2. #17
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    dear oh dear. simple instructions still not good enough....
    look
    Code:
    cout << "How many items would you like to buy? ";
    cin >> times; // this leaves a newline in the stream that getline takes as its input
    
    for(int i = 1;i <= times;i++)
    {
    
    
    cout << "Which item would you like to buy? ";
    //its completely skipping over this getline
    cin.ignore(80,'\n'); // this will remove from the stream 80 chars or up to a newline whichever comes first
    cin.getline(item,30); // hey presto not skipped anymore!
    
    cout<< "How many?: ";
    cin>>num_of;
    cout<<"\n";
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #18
    Registered User
    Join Date
    Nov 2001
    Posts
    255
    yea tahts whats i have but something seems to be effecting he value of those constants that i have being intialized at the beginning i cant figure that out?
    hooch

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-27-2005, 12:05 AM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 04:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 05:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 12:04 PM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 06:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21