1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
| #include <stdio.h>
#include <iostream>
#include <windows.h>
void InputData(float *Math_1,float *Alg_1,float *Amp_1,int *student); // Функция ввода данных.
void calculateScholarship(float *Math_2,float *Alg_2,float *Amp_2,float *summa,float *step); // Функция расчета стипендии.
void calculateQuantitivePerformance(float *Math_3,float *Alg_3,float *Amp_3,float *usp_1,float *usp_2,float *usp_3,float *exam_1,float *exam_2,float *exam_3); //Функция вычисления кол-ва сдавших выше 2.
void calculateQualitativePerformance(float *Math_4,float *Alg_4,float *Amp_4,float *uspp_1,float *uspp_2,float *uspp_3,float *examp_1,float *examp_2,float *examp_3);// Функция вычисления кол-ва сдавших выше 3.
void printTable(float *Math_1,float *Alg_1,float *Amp_1,float *Math_2,float *Alg_2,float *Amp_2,float *Math_3,float *Alg_3,float *Amp_3,float *exam_1,float *exam_2,float *exam_3,float *examp_1,float *examp_2,float *examp_3,float *step_1,float *step_2,float *step_3); // Функция для вывода таблицы.
void main()
{
float Alg_1=0,Alg_2=0,Alg_3=0; //Оценки по алгебре.
float Math_1=0,Math_2=0,Math_3=0; //Оценки по мат.анализу.
float Amp_1=0,Amp_2=0,Amp_3=0; // Оценки по программированию.
int number=0; // хранит номер студента.
float summa_1=0,summa_2=0,summa_3=0;//Сумма оценок студентов.
float step_1=0,step_2=0,step_3=0;// Размер стипендии.
float usp_1=0,usp_2=0,usp_3=0; // Для хранения кол-ва сдавших выше 2.
float exam_1=0,exam_2=0,exam_3=0; // для вычисления % сдавших выше 2.
float uspp_1=0,uspp_2=0,uspp_3=0; // Для хранения кол-ва сдавших выше 2.
float examp_1=0,examp_2=0,examp_3=0; // для вычисления % сдавших выше 3.
setlocale(0,"");
InputData(&Math_1,&Alg_1,&Amp_1,&number);
InputData(&Math_2,&Alg_2,&Amp_2,&number);
InputData(&Math_3,&Alg_3,&Amp_3,&number);
calculateScholarship(&Math_1,&Alg_1,&Amp_1,&summa_1,&step_1);
calculateScholarship(&Math_2,&Alg_2,&Amp_2,&summa_2,&step_2);
calculateScholarship(&Math_3,&Alg_3,&Amp_3,&summa_3,&step_3);
calculateQuantitivePerformance(&Math_1,&Alg_1,&Amp_1,&usp_1,&usp_2,&usp_3,&exam_1,&exam_2,&exam_3);
calculateQuantitivePerformance(&Math_2,&Alg_2,&Amp_2,&usp_1,&usp_2,&usp_3,&exam_1,&exam_2,&exam_3);
calculateQuantitivePerformance(&Math_3,&Alg_3,&Amp_3,&usp_1,&usp_2,&usp_3,&exam_1,&exam_2,&exam_3);
calculateQualitativePerformance(&Math_1,&Alg_1,&Amp_1,&uspp_1,&uspp_2,&uspp_3,&examp_1,&examp_2,&examp_3);
calculateQualitativePerformance(&Math_2,&Alg_2,&Amp_2,&uspp_1,&uspp_2,&uspp_3,&examp_1,&examp_2,&examp_3);
calculateQualitativePerformance(&Math_3,&Alg_3,&Amp_3,&uspp_1,&uspp_2,&uspp_3,&examp_1,&examp_2,&examp_3);
printTable(&Math_1,&Alg_1,&Amp_1,&Math_2,&Alg_2,&Amp_2,&Math_3,&Alg_3,&Amp_3,&exam_1,&exam_2,&exam_3,
&examp_1,&examp_2,&examp_3,&step_1,&step_2,&step_3);
system("pause");
}
void InputData(float *Math_1,float *Alg_1,float *Amp_1,int *student)
{
*student+=1;
printf("Введите оценку по алгебре для %i-го студента: ",*student);
scanf("%f",&*Alg_1);
printf("Введите оценку по Мат.анализу для %i-го студента: ",*student);
scanf("%f",&*Math_1);
printf("Введите оценку по программированию для %i-го студента: ",*student);
scanf("%f",&*Amp_1);
system("cls");
}
void calculateScholarship(float *Math_2,float *Alg_2,float *Amp_2,float *summa,float *step)
{
*summa = *Math_2 + *Alg_2 + *Amp_2;
if (*summa > 8)
{
if ((*Math_2 == 3 ) || (*Alg_2 == 3) || (*Amp_2 == 3))
{
*step = *summa * 250;
}
if ((*Math_2 > 3) && (*Alg_2 > 3) && (*Amp_2 > 3))
{
*step = *summa * 250;
*step = *step + (*step / 100 * 25);
}
if ((*Math_2 > 4) && (*Alg_2 > 4) && (*Amp_2 > 4))
{
*step = *summa * 250;
*step = *step + (*step / 100 * 50);
}
} else *step = 0;
}
void calculateQuantitivePerformance(float *Math_3,float *Alg_3,float *Amp_3,float *usp_1,float *usp_2,float *usp_3,float *exam_1,float *exam_2,float *exam_3)
{
if(*Math_3 >= 3) *usp_1 += 1;
*exam_1 = *usp_1 / 3 * 100;
if(*Alg_3 >= 3) *usp_2 += 1;
*exam_2 = *usp_2 / 3 * 100;
if(*Amp_3 >= 3) *usp_3 += 1;
*exam_3 = *usp_3 / 3 * 100;
}
void calculateQualitativePerformance(float *Math_4,float *Alg_4,float *Amp_4,float *uspp_1,float *uspp_2,float *uspp_3,float *examp_1,float *examp_2,float *examp_3)
{
if(*Math_4 >= 4) *uspp_1 += 1;
*examp_1 = *uspp_1 / 3 * 100;
if(*Alg_4 >= 4) *uspp_2 += 1;
*examp_2 = *uspp_2 / 3 * 100;
if(*Amp_4 >= 4) *uspp_3 += 1;
*examp_3 = *uspp_3 / 3 * 100;
}
void PrintTable(float *Math_1,float *Alg_1,float *Amp_1,float *Math_2,float *Alg_2,float *Amp_2,float *Math_3,float *Alg_3,float *Amp_3,float *exam_1,float *exam_2,float *exam_3,float *examp_1,float *examp_2,float *examp_3,float *step_1,float *step_2,float *step_3)
{
setlocale(0,"");
printf("№ студента Алгебра Мат.анализ ЯМП Стипендия, руб\n");
printf("\n");
printf("1 %1.0f %1.0f %1.0f %7.2f\n",*Math_1,*Alg_1,*Amp_1,*step_1);
printf("\n");
printf("2 %1.0f %1.0f %1.0f %7.2f\n",*Math_2,*Alg_2,*Amp_2,*step_2);
printf("\n");
printf("3 %1.0f %1.0f %1.0f %7.2f\n",*Math_3,*Alg_3,*Amp_3,*step_3);
printf("\n");
printf("Кол.усп %4.1f %4.1f %4.1f\n",*exam_1,*exam_2,*exam_3);
printf("\n");
printf("Кач.усп %4.1f %4.1f %4.1f\n",*examp_1,*examp_2,*examp_3);
} |