fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct User
  5. {
  6. string username;
  7. string friends[5];
  8. int age;
  9. };
  10.  
  11. int main()
  12. {
  13. User userAhmed;
  14.  
  15. cout << "What your username?" << endl;
  16. cin >> userAhmed.username;
  17.  
  18. cout << "What your friends' names?" << endl;
  19. for (int i = 0; i < 5; i++)
  20. {
  21. cout << i + 1 << "- ";
  22. cin >> userAhmed.friends[i];
  23. };
  24.  
  25. cout << "What your age?" << endl;
  26. cin >> userAhmed.age;
  27.  
  28. cout << "Nice your name is " << userAhmed.username << " and you're " << userAhmed.age << " years old, and your friends are:" << endl;
  29.  
  30. for (int i = 0; i < 5; i++)
  31. {
  32. cout << i + 1 << "- " << userAhmed.friends[i] << endl;
  33. };
  34.  
  35. return 0;
  36. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
What your username?
What your friends' names?
1- 2- 3- 4- 5- What your age?
Nice your name is  and you're 200725832 years old, and your friends are:
1- 
2- 
3- 
4- 
5-