Newbie question

This is a discussion on Newbie question within the C++ Programming forums, part of the General Programming Boards category; Code: #include <iostream> #include <stdlib.h> using namespace std; int main(int argc, char *argv[]) { cout<<"hello world!\n\n"; system("PAUSE"); cout<<"yeah babeeh\n\n"; system("PAUSE"); ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    1

    Newbie question

    Code:
    #include <iostream>
    #include <stdlib.h>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
      cout<<"hello world!\n\n";
      system("PAUSE");	
      cout<<"yeah babeeh\n\n";
      system("PAUSE");
      char string;
      cout>>"Say something: ";
      cin.getline(string);
      cout<<"\nYou said: "<<string;
      system("PAUSE");
      return 0;
    }
    why doesn't work?
    thanks..
    Last edited by Dagan; 05-15-2004 at 01:14 PM.

  2. #2
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    char string; gives you a variable to store ONLY one character
    char string [100]; gives you a variable to store 100 characters
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 05:43 AM
  2. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 06:45 PM
  3. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 04:38 PM
  4. confusion with integers (newbie question)
    By imortal in forum C Programming
    Replies: 7
    Last Post: 12-06-2002, 04:09 PM
  5. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 10:50 AM

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