C++ program to read some number of lines of text until user enters any user defined character and Display it

//C++ program to read some number of lines of text until user enters '*' character and Display it.

#include <iostream>
using namespace std;
int main()
{
    char name[100];
    cout<<"Enter multiple lines of string(use * to stop reading):";
    cin.getline(name,100,'*'); //cin.get(name,100,'*');
    cout<<"You entered:"<<endl<<name;
    return 0;
}

No comments:

Post a Comment