Advertisement
laith-0093

C++

Jan 14th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct student
  5. {
  6. char name[50];
  7. int roll;
  8. float marks;
  9. } s[10];
  10.  
  11. int main()
  12. {
  13. cout << "Enter information of students: " << endl;
  14.  
  15. // storing information
  16. for(int i = 0; i < 10; ++i)
  17. {
  18. s[i].roll = i+1;
  19. cout << "For roll number" << s[i].roll << "," << endl;
  20.  
  21. cout << "Enter name: ";
  22. cin >> s[i].name;
  23.  
  24. cout << "Enter marks: ";
  25. cin >> s[i].marks;
  26.  
  27. cout << endl;
  28. }
  29.  
  30. cout << "Displaying Information: " << endl;
  31.  
  32. // Displaying information
  33. for(int i = 0; i < 10; ++i)
  34. {
  35. cout << "\nRoll number: " << i+1 << endl;
  36. cout << "Name: " << s[i].name << endl;
  37. cout << "Marks: " << s[i].marks << endl;
  38. }
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement