Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include"stdafx.h"
- #include "string"
- #include <iostream>
- /*
- create a strcutre for student including (name ,satge, degree1,degree2)
- define 5 structure and find average for every student
- */
- using namespace std;
- struct student {
- int stage, degree1, degree2;
- string name;
- };
- int main()
- {
- student std[5];
- int i, av[5], sum[5];
- for (size_t i = 0; i < 5; i++)
- {
- cout << "Name : ";
- cin >> std[i].name;
- cout << "Stage : ";
- cin >> std[i].stage;
- cout << "Degree 1 : ";
- cin >> std[i].degree1;
- cout << "Degree 2 : ";
- cin >> std[i].degree1;
- sum[i] += std[i].degree1 + std[i].degree2;
- }
- for (size_t i = 0; i < 5; i++)
- {
- av[i] = sum[i] / 2;
- cout << "Av for student [ " << i + 1 << " ] :" << av[i] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment