Thread: convert printf / structure

  1. #1
    Registered User Max's Avatar
    Join Date
    Jul 2002
    Posts
    110

    convert printf / structure

    How can I convert this C code into (new)C++
    I am trying to print a structure.


    printf("Phone: %s\n\n", thisName->phoneNumber);

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    Re: convert printf / structure

    Originally posted by Max
    How can I convert this C code into (new)C++
    I am trying to print a structure.


    printf("Phone: %s\n\n", thisName->phoneNumber);
    Simple. Do this:

    Code:
    cout << "Phone: " << thisName->phoneNumber << endl << endl;
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  3. making it portable.....?
    By ShadeS_07 in forum C Programming
    Replies: 11
    Last Post: 12-24-2008, 09:38 AM
  4. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  5. Replies: 4
    Last Post: 04-01-2003, 12:49 AM