Answers for "header file for getline in c++"

C++
4

c++ reading string

#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
Posted by: Guest on January-26-2020
0

getline of file C++

ifstream inFile;
string name;
int age;

inFile.open("file.txt");

getline(inFile, name); 
inFile >> age; 

cout << name << endl;
cout << age << endl;  

inFile.close();
Posted by: Guest on October-09-2020

Browse Popular Code Answers by Language