convert printf / structure

This is a discussion on convert printf / structure within the C++ Programming forums, part of the General Programming Boards category; How can I convert this C code into (new)C++ I am trying to print a structure. printf("Phone: %s\n\n", thisName->phoneNumber);...

  1. #1
    Max
    Max is offline
    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, 09:25 AM
  2. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  3. making it portable.....?
    By ShadeS_07 in forum C Programming
    Replies: 11
    Last Post: 12-24-2008, 08:38 AM
  4. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 04:42 PM
  5. Replies: 4
    Last Post: 03-31-2003, 11:49 PM

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