Thread: Is cin for only numbers??

  1. #16
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    That is because name[10] does not exist, the array only consists of elements 0-9. Try this...

    #include <iostream>
    using namespace std;
    int main()
    	char name[10];
    	cin.getline(name, 11);
    	cout << name[9];
    	return 0;
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  2. #17
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    dang... i cant believe i forgot something so fundamental.
    I guess i shouldnt rush things, no matter how simple they appear to be...
    I AM WINNER!!!1!111oneoneomne

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adding Line numbers in Word
    By Mister C in forum A Brief History of
    Replies: 24
    Last Post: 06-24-2004, 08:45 PM
  2. input with cin....
    By MainFrame in forum C++ Programming
    Replies: 3
    Last Post: 03-19-2004, 06:10 PM
  3. the definition of a mathematical "average" or "mean"
    By DavidP in forum A Brief History of
    Replies: 7
    Last Post: 12-03-2002, 11:15 AM
  4. Line Numbers in VI and/or Visual C++ :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 02-10-2002, 10:54 PM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 06:38 PM