Machine Problem in C++

4.Summative Assessment 2

Complete the  given  code to produce  an  output Like this:

Records  of  Student

ID  Name  Grade

1   Ronel  86.5

2   lance  90.5

30  Bianca  81.5

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Program Listing

/*
4.Summative Assessment 2
Complete the  given  code to produce  an  output Like this:
Records  of  Student
ID  Name  Grade
1   Ronel  86.5
2   lance  90.5
30  Bianca  81.5
*/

#include  <iostream>
#include  <cstring>

using  namespace  std;

struct  student
{
    int  id;
    char  name[30];
    float  percentage;
};

ostream& operator<<(ostream& os, const student s)
{
    return os << s.id << "\t" << s.name << "\t" << s.percentage;
}

int  main()
{
    int  i;
    struct  student  record [3];
    record[0] .id= 1;
    strcpy(record[0] .name,  "Ronel");
    record[0] .percentage  =  86.5;

    record[1] .id=2;
    strcpy(record[1] .name,  "Lance");
    record[1] .percentage  =  90.5;

    record[2].id=3;
    strcpy(record[2] .name,  "Bianca");
    record[2].percentage  =  81.5;
    
    cout << "\n\n";
    cout <<"\tStudents Records in C++";
    cout << "\n\n";
    cout << "\tRecords  of  Student:\n\n";
    cout << "\tID\tName\tGrade\n";
    for (int i = 0; i < 3; ++i)
     
        {		
        cout <<"\t"<< record[i] << "\n";
    }
return  0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *