questino on promoting the user

This is a discussion on questino on promoting the user within the C++ Programming forums, part of the General Programming Boards category; I am trying to create a health club maintain that promotes the User to insert the client name and his ...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    58

    questino on promoting the user

    I am trying to create a health club maintain that promotes the User to insert the client name and his ID#. I have to use char[15] to store his name and his ID#. Is there any way to store both the name of the client and his ID# in one pace. For example, I want to store both the name of the client and his ID# in char[1]. I am not ALLOWED to promote the user to Insert his name and his ID# all At once for Example This is considered illegal ( Sam 333-1245 )!! I have to promote the name first then the ID# second, then finally store both of them in one place EX


    Code:
    if ( number ==1 ){
    	cout << "Insert the client's name" << endl;
    	cin >> clientName;
    	cout << "Insert a new ID" << endl;
    	cin >>clientIDNumber;
    }

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Why not create a class to store this kind of info?

    BTW, I don't think you fully understand char arrays, but since this is C++, you should avoid their usage if you can. Try std::string instead.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    58
    Ok! .. there is a problem now

    I have char[15] // There are 15 empty spaces to store in:


    // The first try of promoting the user for his name and his Id#
    Code:
    if ( number ==1 ){
    	cout << "Insert the client's name" << endl;
    	cin >> clientName;
    	cout << "Insert a new ID" << endl;
    	cin >>clientIDNumber;
    }


    // here is the problem when I want to store just the name this time in the char[0] and make sure that the next time I promote the user to insert the second client's name will be stored in the next place which is char[1] untill it hits the end and then the pogrom will send an error message. I need a hint for that because I am stuck!! lol

    Code:
    string healthClubMaintain::addClient(clientName,clientIDNumber){
    
    	classCleintName = clientName;
    	classClientIDNumber = clientIDNumber;
    	
    	while(i<15)
    	{
    		char[i]=classCleintName;
    		i++;
    	}
    	
    }

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    You need to go back to the basics. What you're doing makes little sense and has some notable errors. For me to explain it all to you would be kind of pointless.

    I'll try to get you started:

    I want to store just the name this time in the char[0]
    Each element of a char array holds one char, not a string, so this is wrong.

  5. #5
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    Code:
    string healthClubMaintain::addClient(clientName,clientIDNumber)
    Is it C++?
    Where are the parameter types?
    Where is the return?
    if you need vector of strings - use vector of strings, not array of chars
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 04-03-2008, 09:07 PM
  2. Add/Delete Remotely a user
    By Scarvenger in forum Windows Programming
    Replies: 5
    Last Post: 03-24-2008, 08:36 AM
  3. Replies: 4
    Last Post: 04-21-2004, 04:18 PM
  4. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 05:01 AM
  5. Stopping a user from typeing.
    By knave in forum C++ Programming
    Replies: 4
    Last Post: 09-10-2001, 12:21 PM

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