fork download
  1. /// Version 1
  2.  
  3. #include<iostream>
  4. using namespace std;
  5. string display();
  6. int main()
  7. {
  8. // This time, I can do whatever I want whenever I get the user's name
  9. string a= display();
  10. cout<<"Name is\t"<<a<<endl;
  11. cout << "Goodbye, "<< a << "!" << endl;
  12. return 0;
  13. }
  14. string display()
  15. {
  16. string name;
  17. cout<<"Enter the Nmae\n";
  18. cin>>name;
  19. return name;
  20. }
  21.  
Success #stdin #stdout 0.01s 2860KB
stdin
george
stdout
Enter the Nmae
Name is	george
Goodbye, george!