I'm new to C++ (used to work with Java). So I'm trying to code my first program.
I'd like after executing getline() to move the cursor at the end of the line. Unfortunately it is at the beginning. Is there a way to do so ? Thanks. Below my code.
Sorry for not being clear. Let me complete my question. For example
cout >> "Hello Gerard how are you ?";
After this instruction the cursor is positioned before "Hello". Since the next instruction is cin I'd like to have the cursor positioned after "you ?" in order to type immediately the response.
But I'm not sure whether it is possible. Thanks a lot.
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string question1 = "Quel est ton nom ? ";
string question2 = "Où vis-tu ? ";
string answer1, answer2;
cout << question1;
getline(cin,answer1);
cout << question2;
getline(cin,answer2);
cout << "Bien le bonjour, " << answer1;
cout << " de " << answer2 << "!\n";
return 0;
}