,   CyberForum.ru

- C++

 
MegaVolt91
0 / 0 / 0
: 14.05.2009
: 29
28.05.2009, 20:35     #1
:
. , , , . : , ,

C++
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
#include <stdio.h> 
#include <iostream.h>
#include <conio.h>
struct student        //   
{ char name[20];      // 
char fam[30];          // 
int year;              // 
int mark[5];           // 
int average;           //  
};
student students[30];      //    
student buffer;          //  
int records;          //    
int i, j ;
student mass[30];        //  
void main ( )
{ records = 0 ;      //   
do        //   
{ cout <<  "  " << records+1 << endl;
cout <<  "  ";  fflush(stdin) ;
cin >> students [records].fam;
cout <<  "   ";
cin >> students [records].name;
cout <<  "  ";
cin >> students [records].year;
for(i = 0; i < 5; i++)
{ cout << "           "  <<  i+1 << endl;
cin >> students[records].mark[i];
}
records++;
cout << " ? [1/0]  ";
cin >> i;
}     while(i) ;
for(i = 0; i < records; i++)         //   
{   students [ i ].average = 0;
for (j=0;  j < 5; j++)
students[i].average += students[i].mark[j ];
}
for (i = 0; i < records-1; i++)       // 
for (j = i; j < records; j++)          //       
if (students[i].average > students[j].average)
{     buffer = mass[i];     //  
mass[i] = mass[j];         // , 
mass[j] = buffer;         //  C/C++
}
for (i = 0; i < records; i++)     //  
{ cout << "\n  " << students[i].name  <<  "\t" << students [i].fam ;
cout << "  " <<  students [i].year;  
cout << " .  " <<  students[i].average;
}
int k=0;
for ( int i=0; i<30; ++i )
if ((students[i].name=='Natalya')||(students[i].name=='Vladimir')||(students[i].name=='Roman')) {++k};
    printf("%d",k);
}
:
Error 88888.CPP 53: Character constant must be one or two characters long
Error 88888.CPP 53: Cannot convert 'int' to 'char *'
Error 88888.CPP 53: Character constant must be one or two characters long
Error 88888.CPP 53: Cannot convert 'int' to 'char *'
Error 88888.CPP 53: Character constant must be one or two characters long
Error 88888.CPP 53: Cannot convert 'int' to 'char *'
Error 88888.CPP 53: Statement missing ;
Error 88888.CPP 55: Compound statement missing }
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
28.05.2009, 20:35    
:

C++ . ,
C++ !
C++ " ",
C++
C++
C++
C++
C++
C++
,, :) C++
C++



:
.
EnzoMatrix
   EnzoMatrix
120 / 120 / 4
: 14.03.2009
: 462
28.05.2009, 21:16     #2
C++
1
(students[i].name=='Natalya')

C++
1
(!strcmp(students[i].name,"Natalya"))

string.h
Neogen
2 / 2 / 0
: 23.04.2009
: 24
28.05.2009, 21:19     #3
? C++Builder 6 .

C++
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
//---------------------------------------------------------------------------
 
#pragma hdrstop
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
#include <string.h>
struct student        // Ø*áëî* ñòðóêòóðû
{
char name[20];          // èìÿ
char fam[30];          // ô*ìèëèÿ
int year;              // âîçð*ñò
int mark[5];           // îöå*êè
int average;           // Ñóìì* á*ëîâ
};
//---------------------------------------------------------------------------
 
#pragma argsused
int main(int argc, char* argv[])
{
student students[30];      // Ì*ññèâ ä***ûõ ïî ãðóïïå
student buffer;          // Äîïîë*èòåëü**ÿ ñòðóêòóð*
int records;          // Êîëè÷åñòâî ñòóäå*òîâ â ãðóïïå
int i, j ;
student mass[30];        // Âñïîìîã*òåëü*ûå ïåðåìå**ûå
records = 0 ;      // Ñ**÷*ë* ç*ïèñåé *åò
do        // Ç*ïîë*ÿåì ì*ññèâ ñòðóêòóð
{ cout <<  "Studen ¹ " << records+1 << endl;
cout <<  "Enter  family";  fflush(stdin) ;
cin >> students [records].fam;
cout <<  "Enter name  ";
cin >> students [records].name;
cout <<  "Enter age ";
cin >> students [records].year;
for(i = 0; i < 5; i++)
{ cout << "Enter an estimation on examination ¹  " <<i+1 <<endl;
cin >> students[records].mark[i];
}
records++;
cout << "To stop work? [1/0]  ";
cin >> i;
}     while(i) ;
for(i = 0; i < records; i++)         // Ïîäñ÷èòûâ*åò ñóììó á*ëëîâ
{   students [ i ].average = 0;
for (j=0;  j < 5; j++)
students[i].average += students[i].mark[j ];
}
for (i = 0; i < records-1; i++)       // ñîðòèðóåò
for (j = i; j < records; j++)          //     ïî ñóììå á*ëëîâ
if (students[i].average > students[j].average)
{     buffer = mass[i];     // Ïåðåñò**îâê* ýëåìå*òîâ
mass[i] = mass[j];         // ñòðóêòóðû, îñîáå**îñòü
mass[j] = buffer;         // ÿçûê* C/C++
}
for (i = 0; i < records; i++)     // Âûâîäèì ðåçóëüò*ò
{ cout << "\n Student " << students[i].name  <<  "\t" << students [i].fam ;
cout << " Age " <<  students [i].year;
cout << " Mean score" <<  students[i].average;
}
int k=0;
for ( int i=0; i<30; i++)
if ((!strcmp(students[i].name,"Natalya"))||(!strcmp(students[i].name,"Vladimir"))||(!strcmp(students[i].name,"Roman")))
        {
        k++;
        };
        printf("%d",k);
return 0;
 
}
//---------------------------------------------------------------------------
///CartmanRules )
Yandex
28.05.2009, 21:19    

: 21:59. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
@Mail.ru