Computer Science, asked by aakankshagupta745, 7 months ago

Student details
Jeeva is the chairman of ABC university and he is planned to improve students education. So he is conducted meeting for all departments HODs. Write a program to help all department HODs to display student details. Create a structure called Student. struct Student { char name[30]; char department[20]; int yearOfStudy; float cgpa; }; Write a program to get the details of 'n' students and to display their details, sorted in ascending order based on the name.
INPUT & OUTPUT FORMAT:

Refer sample input and output for formatting specification.

All float values are displayed corrected to 2 decimal places.

SAMPLE INPUT & OUTPUT:

Enter the number of students

1

Enter the details of student 1

Enter name

krish

Enter department

mca

Enter year of study

3

Enter cgpa

7.6

Details of students

Student 1

Name : krish

Department : mca

Year of study : 3

CGPA : 7.6

Answers

Answered by sushmith929
1

Answer:

#include<iostream>

using namespace std;

int main()

{

 int z,x=1,y=0;

 cin>>z;

 int a[z];

 for(int i=0;i<z;i++)

   cin>>a[i];

 cout<<x;

 for(int i=1;i<z;i++)

 {

   if(a[i]<a[i-1])

     cout<<"\n"<<x;

   else

   {

     y+=2;

     cout<<"\n"<<y;

   }

 }

}

Explanation:

All hidden test case passed

Similar questions