fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. string name;
  7. string studentID;
  8. string department;
  9.  
  10. // Input section
  11. cout << "Enter your name: ";
  12. getline(cin, name);
  13.  
  14. cout << "Enter your student ID: ";
  15. getline(cin, studentID);
  16.  
  17. cout << "Enter your department: ";
  18. getline(cin, department);
  19.  
  20. // Output section
  21. cout << "\n--- Personalized Welcome ---" << endl;
  22. cout << "Welcome, " << name << "!" << endl;
  23. cout << "Your Student ID is: " << studentID << endl;
  24. cout << "Department: " << department << endl;
  25. cout << "We are glad to have you in the Introduction to Programming course." << endl;
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5280KB
stdin
Dexter Morgan
2510994514
stdout
Enter your name: Enter your student ID: Enter your department: 
--- Personalized Welcome ---
Welcome, Dexter Morgan!
Your Student ID is: 2510994514
Department: 
We are glad to have you in the Introduction to Programming course.