Mega Code Archive

 
Categories / C++ / Console
 

Use the getline function to read the users input and assign that input to the character array

#include <iostream> using namespace std; int main () {    char name[80] = {'J', 'e', 'f', 'f', '/0' };    cout << "Enter your name: ";    cin.getline(name, 80);    cout << "Your name is " << name;    return 0; }