need help remembering

This is a discussion on need help remembering within the C++ Programming forums, part of the General Programming Boards category; ok stoped for 2 years decided to get back into it im makeing a program so that when you hit ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    3

    need help remembering

    ok stoped for 2 years decided to get back into it im makeing a program so that when you hit 1 it asks you something but when you hit 1 nothing happens but if you hit it twice then it works any one know whats wrong heres my code.

    Code:
    #include <iostream.h>
    #include <conio.h>
    #include "leadheader.h"
    
    int main()
    {
    char input;
    
    item a("Bob", 1, 10, 9, 3);
    a.Change_Price(25);
    a.Display();
    
    input = getch();
    
    switch(input)
    {
    case '1':
    clrscr();
    char tname[25];
    cout<<"Enter Name: ";
    cin.getline(tname, 25, '\n'); 
    a.Change_Name(tname);
    clrscr();
    a.Display();
    break;
    }
    
    return 0;
    }
    remember the code tags atleast

  2. #2
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Code:
    #include <iostream.h>
    #include <conio.h>
    #include "leadheader.h"
    
    int main()
    {
    char input;
    
    item a("Bob", 1, 10, 9, 3);
    a.Change_Price(25);
    a.Display();
    
    cout << "enter somthing: ";
    getline(cin,input);
    
    switch(input)
    {
    case '1':
    clrscr();
    char tname[25];
    cout<<"Enter Name: ";
    cin.getline(tname, 25, '\n'); 
    a.Change_Name(tname);
    clrscr();
    a.Display();
    break;
    }
    
    return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with remembering numbers
    By SebastionV3 in forum C++ Programming
    Replies: 14
    Last Post: 05-08-2006, 03:39 AM
  2. Remembering how to register a window
    By Sentral in forum Windows Programming
    Replies: 2
    Last Post: 04-25-2006, 05:18 PM
  3. Google remembering my keywords
    By m712 in forum Tech Board
    Replies: 4
    Last Post: 07-26-2003, 12:48 PM

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