Thread: Array (seperate inputs by comma)

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    Array (seperate inputs by comma)

    I am new with C. what I am attempting to do is to ask for 2 names seperated by a comma (ie. Smith, John). then trying to cout them as (John Smith). I have an idea but just have no clue how to write it...

    this is what I have so far...

    #include <stdio.h>
    #include <conio.h>
    #include <iostream.h>
    #include <string.h>

    main () {
    clrscr();

    char name[50];

    cout<<endl<<"Please enter your name (lastname, firstname): ";
    cin >>name;

    while (

    cout<<endl<<;

    cout<<endl<<"press any key to exit...";
    getch();

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    this is C++ not C

    and very outdated C++

    iostream.h should be replaced by iostream for example

    decide - what langauge you are lerning and update your compiler to some modern time one
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 11-25-2008, 01:50 AM
  2. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  3. Template Array Class
    By hpy_gilmore8 in forum C++ Programming
    Replies: 15
    Last Post: 04-11-2004, 11:15 PM
  4. two dimensional dynamic array?
    By ichijoji in forum C++ Programming
    Replies: 6
    Last Post: 04-14-2003, 04:27 PM
  5. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM