Escolar Documentos
Profissional Documentos
Cultura Documentos
STAR
T
Including header files
Function
Prototypes
Main() function
An empty <vector> with name data is declared
Initiate for() loop and take input from user in each iteration
Prelab 03
In this code, a structure is made of the name student. The structure
contains the following information about the student:
Name of data type string
Department of data type string
Roll no. of data type int
Cgpa of data type float
Then the main function is there to input data to the structure. Firstly, the two
variables are declared of the data type student. The information of two
students is printed on the screen with the help of this structure, by using
statement out(). At last, the size of the variable, ali, is printed by usin the
statement sizeof().
POSTLAB 03
#include <iostream>
struct batsman
{
int position;
string name;
string team;
float bat_avg;
int rating;
};
int main()
{
batsman top[30];
top[0] = {1 ,"A.B.de Villiers","South Africa",54.21,900};
top[1] ={2,"V.Kohli","India",51.82,804};
top[2] = {3,"H.M. AMla","South Africa",52.70,776};
top[3]={4,"K.S. Williamson","Newzeland",47.86,770};
cout << "In order to display top 10 batsmen press a" <<
endl << endl;
else if (check2 == 4)
{
cout << endl;
modifying_func(top, 30);
cout << "To display edited list press
9" << endl << endl;
display_top_10(top);
}
else
{
cout << "Invalid input"
<< endl << endl;
return 6;
}
}
}
else
{
cout << "\nIncorrect password" << endl;
return 0;
}
}
}
>> arr[arr_position-1].name;