is there any way to print a variable, and edit it on line ????
ex:
1 2 3 4 5
line1. string name1="Marc"; string name2;
line2. cout<<"Your name is :"<<name1;
line3. getline(cin, name2);
line4. if(!name2.empty())
line5. name1 = name2;
this code does display the name1, but does not allow me to edit it !
I want to know if there is any possibility in c++ to print the value of "name"
and change it if I want.
Thank you,
How can I print it using te ostream operator that exist in an other file ?
Ex:
Client.cpp contain my ostream function
Client.h contain the line that makes it a friend
And main.cpp contain The function that print the name with with the ostream "-"
#include <iostream>
#include "point.hpp"
int main()
{
point p( -7, 4.3 );
std::cout << "I have a point at " << p << ".\n";
}
Compile and link your .cpp files together.
With GCC: g++ -Wall -pedantic -std=c++14 -O2 -s main.cpp point.cpp
With MSVC: cl /EHsc /O2 main.cpp point.cpp
Etc.