how to get a string using array?
and how can I get input in this format
string|12.3 12.23 |
example;with no space between the lines and when user enter 0 it will exit
david|12.3 24.2|
Peter|12.4 24.2|

Yeah... what?

So how can I do it?
the input should be like this:
david | 12.2 23.4 324.5 |
Jack |12.3 23.4 22.3 54.3 |

I don't know how many will the user enter names or data?
I should use an escape word like EXIT so when user types exit it goes to another function?
If I use cin.getline it skips to next line making the format this
david
| 12.23 34.3 344.3 |
it all should be in one line
plz help

Looks like English isn't your native language. Unforturnately, that means it is difficult for me to understand what you are trying to do.

getline() will accept input from the keyboard (or other source) and store it in a string variable. It has nothing to do with how the value of the variable is displayed on the screen or how it is stored in file or how it is printed on paper.

#include<iostream>
#include<string>
using namespace std;
int main()
{
   string firstInput;
   string secondInput;
   cout << "enter the following string.  DON'T push the ENTER key until the entire string is entered:   david | 12.2 23.4 324.5 |";
   getline(cin, firstInput);
   cout << "enter the following string.  DON'T push the ENTER key until the entire string is entered: Jack |12.3 23.4 22.3 54.3 |";
  getline(cin, secondInput);
  cout << firstInput;
  cout << '\n';  //comment out this line to put both inputs on the same line
   cout << secondInput;
   cin.get();
   return 0;
}

"

people often have to wait during ..

The user should be prompted to enter as many names and waiting time as he desires in the following
format: name | 1.2 3.4 3.4 … |

?

Use a list or a vector or some other self expanding container to hold all the inputs. Use a loop to get the input. I'd still use string to hold each input.

vector<string>inputs;
string input;
char answer;
bool getMoreInput = true;
while(getMoreInput)
{
   //tell user how to enter input here
   //get input here
   //add input to inputs here
   //ask user if they want to enter another input
   //if answer is 'n' then change value of getMoreInput here
}

I don't know how to use vectors!
regarding using string!Strings doesn't work fine with this, because I don't know how many times the user will enter data!

I don't know how to use vectors!

Then learn how to use vectors:
http://www.dreamincode.net/forums/showtopic33631.htm
http://www.cplusplus.com/reference/stl/vector/

regarding using string!Strings doesn't work fine with this, because I don't know how many times the user will enter data!

That's why you use a vector. You may want to set up a struct:

struct record
{
    string name;
    vector <double> waitingtimes;
};

vector <record> records;

You'll have to parse each line to make a record out of something like this:

Jack |12.3 23.4 22.3 54.3 |

Read each line in as a string, then parse the string to get the components (basically what Lerner is suggesting, but one step further).

The atof or strtod functions may be useful when converting from strings to doubles.
http://www.cplusplus.com/reference/clibrary/cstdlib/atof.html
http://www.cplusplus.com/reference/clibrary/cstdlib/strtod.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.