Advertisement
Farhana_Zaman

Untitled

May 15th, 2022
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.  
  6. cout<< "Total number of the students: ";
  7. int n;
  8. cin>> n;
  9. string name[n] , district[n];
  10. int age[n];
  11. cout<<"Name Age District"<<endl;
  12. for(int i=0; i<n; i++)
  13. {
  14. cin>> name[i] >> age[i]>> district[i];
  15. }
  16.  
  17.  
  18. cout<< "\nPrint all students details of age less than 20:\n";
  19. for(int i=0; i<n; i++) {
  20. if(age[i] < 20) {
  21. cout<< name[i] << " "<< age[i]<< " " << district[i]<< endl;
  22. }
  23. }
  24.  
  25.  
  26. cout<< "\nNumber of students of Rajshahi District: ";
  27.  
  28. int cnt= 0;
  29.  
  30. for(int i=0; i<n; i++) {
  31. if(district[i] == "Rangpur" ) {
  32. cnt++;
  33. }
  34. }
  35.  
  36. cout<< cnt<< endl;
  37.  
  38. int cnt2=0;
  39. for(int i=0; i<n; i++) {
  40. if(name[i][0] == 'S' ) {
  41. cnt2++;
  42. }
  43. }
  44. cout<< "\nNumber of students name start with S: "<< cnt2<< endl;
  45. return 0;
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement