name altering

This is a discussion on name altering within the C++ Programming forums, part of the General Programming Boards category; doug :ive been begging my parents to buy me a book for the past year..he wont because he thinks everyone ...

  1. #16
    Registered User
    Join Date
    Sep 2005
    Posts
    196
    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 dollars...my dads a cheap ass ,so ive been learning for cplusplus.com sadly they dont have activities for you to do.

  2. #17
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by swoopy
    Quote Originally Posted by Dave_Sinkula
    I try to avoid overallocating, so I was just thinking about using getline.
    Code:
    #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
    Posts
    2,934
    Quote Originally Posted by Dave_Sinkula
    ????
    I stand corrected. Admittedly I was looking at your code, and missed what it actually outputted.

Page 2 of 2 FirstFirst 12
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, 01: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, 04:15 PM
  5. Altering files in another file system??
    By Raavin in forum C++ Programming
    Replies: 2
    Last Post: 09-28-2001, 10:18 AM

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