Thread: name altering

  1. #16
    Registered User
    Join Date
    Sep 2005
    doug :ive been begging my parents to buy me a book for the past year..he wont because he thinks everyone on the internet will hack him and get his credit card number...than when i eventually convinced him enouph to look at the site he was outraged it was more than 10 dads a cheap ass ,so ive been learning for sadly they dont have activities for you to do.

  2. #17
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Quote Originally Posted by swoopy
    Quote Originally Posted by Dave_Sinkula
    I try to avoid overallocating, so I was just thinking about using getline.
    #include <iostream>
    int main(void)
       char name[6];
       std::cout << "name? ";
       std::cin.getline(name, sizeof name);
       std::cout << "name = \"" << name;
       if ( !std::cin )
          std::cout << "...";
          while ( std::cin.get() != EOF ); // eat extra characters
       std::cout << "\"\n";
       return 0; 
    /* my input/output
    name? Dave
    name = "Dave"
    name? Sinkula
    name = "Sinku..."
    And if name happens to be <= 5 characters?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #18
    Registered User
    Join Date
    Oct 2001
    Quote Originally Posted by Dave_Sinkula
    I stand corrected. Admittedly I was looking at your code, and missed what it actually outputted.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Real time altering of screen output
    By Eirik in forum Windows Programming
    Replies: 4
    Last Post: 05-14-2009, 12:05 AM
  2. Need help with altering info on a txt file
    By Netflyer in forum C Programming
    Replies: 29
    Last Post: 02-14-2008, 07:23 AM
  3. Altering The Program's Executable?
    By Aidman in forum C++ Programming
    Replies: 7
    Last Post: 12-31-2002, 05:11 AM
  4. Replies: 10
    Last Post: 06-12-2002, 03:15 PM
  5. Altering files in another file system??
    By Raavin in forum C++ Programming
    Replies: 2
    Last Post: 09-28-2001, 09:18 AM