,   CyberForum.ru

- C++

 
Zambal
83 / 3 / 1
: 14.11.2011
: 68
17.10.2012, 16:48     #1
  • : , , , .
  • . , .
  • . , , , .

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "stdafx.h"
#include <stdio.h>
#include <Windows.h>
 
void main()
{
    FILE*newfile;
    newfile=fopen("newfile.txt","a");
 
    struct master {char fn[15]; char type[10]; int price; int time;};
        master A[2];
            for(int i = 0; i < 2; i++)
            {
                printf("FirstName, Type, Price, Time \n", A[i].fn, A[i].type, &A[i].price, &A[i].time);
                    scanf("\n %s%s%d%d", A[i].fn, A[i].type, &A[i].price, &A[i].time);
                        fprintf(newfile,"%s FirstName %s Type %d Price %d Time \n", A[i].fn, A[i].type, A[i].price, A[i].time);
            }
    system("pause");
}
. , . .
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
17.10.2012, 16:48    
:

C++
C++
C++ .
C++
C++
.
Zambal
83 / 3 / 1
: 14.11.2011
: 68
19.10.2012, 23:31  []     #2
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
#include "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include <string.h>
 
struct Master
{
    char fio[30];
    char type[10];
    int price;
    int time;
};
 
void main()
{
    const int n=2;
    Master Mas[n];
 
    int sum = 0;
 
    for(int i = 0; i < n; i++)
    {
        printf("First Name, Type, Price, Time \n", Mas[i].fio, Mas[i].type, Mas[i].price, Mas[i].time);
            scanf("\n %s%s%d%d", Mas[i].fio, Mas[i].type, &Mas[i].price, &Mas[i].time);
    }
 
    for(int ii = 0; ii < n; ii++)
    {
            printf("\n%5s \t %5s \t %.2d \t %.2d", Mas[ii].fio, Mas[ii].type, Mas[ii].price, Mas[ii].time);
    }
 
    for(int s = 0; s < n; s++) //podschet summi po remontu
    {
        sum += Mas[s].price;    
    }
 
    //vivod obshei summi po rempntu
    printf("\n Summa po remontu = %d", sum);
    
    system("pause");
}
. . .

,
Zambal
83 / 3 / 1
: 14.11.2011
: 68
22.10.2012, 21:14  []     #3
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 "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include <string.h>
 
struct Master
{
    char fio[30];
    char type[10];
    int price;
    int time;
};
 
void main()
{
    const int n=5;
    Master Mas[n];
 
    int sum = 0;
    Master min;
 
    for(int i = 0; i < n; i++)
    {
        printf("First Name, Type, Price, Time \n", Mas[i].fio, Mas[i].type, Mas[i].price, Mas[i].time);
            scanf("\n %s%s%d%d", Mas[i].fio, Mas[i].type, &Mas[i].price, &Mas[i].time);
    }
 
    for(int ii = 0; ii < n; ii++)
    {
            printf("\n%5s \t %5s \t %.2d \t %.2d\n", Mas[ii].fio, Mas[ii].type, Mas[ii].price, Mas[ii].time);
    }
 
    for(int s = 0; s < n; s++) //podschet summi po remontu
    {
        sum += Mas[s].price;    
    }
    
    for(int f = 0; f < n - 1; f++)//poisk samogo bistrogo mastera
    {
        if(Mas[f].time < Mas[f+1].time)
        {
            min=Mas[f];
            Mas[f] = Mas[f+1];
            Mas[f+1] = min;
        }
    }
 
    //vivod fio samogo bistrogo mastera
    printf ("\n Samii bistrii master - %s",Mas[n-1].fio);
 
    //vivod obshei summi po remontu
    printf("\n Summa po remontu = %d", sum);
    
    system("pause");
}
novi4ok
549 / 502 / 8
: 23.07.2009
: 2,359
: 1
22.10.2012, 21:19     #4
c++ qsort
XAVOK
: n/a
22.10.2012, 21:19     #5
, , , declaration terminated incorrectly, .
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
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
#include <iostream.h>
 
struct WORKER
{
char FIO[30];//Ô*ìèëèÿ èìÿ îò÷åñòâî//
int cod;//Êîä äîëæ*îñòè//
char posada[15];//Í*çâ**èå äîëæ*îñòè//
float oklad;//Îêë*ä//
int day;//Êîëè÷åñòâî îòð*áîò***ûõ ä*åé//
 
 
main()
{
WORKER people[4];
int day(m);
 
{{cout<<"Ââåäèòå ÔÈÎ ïåðâîãî ñîòðóä*èê*-";
cin.getline(people[0].FIO,29);
cout<<"Ââåäèòå êîä äîëæ*îñòè ïåðâîãî ñîòðóä*èê*-";
cin >>people[0].cod;
cout<<"Ââåäèòå **çâ**èå äîëæ*îñòè ïåðâîãî ñîòðóä*èê*-";
cin.getline(people[0].posada,14);
cout <<"Ââåäèòå îêë*ä ïåðâîãî ñîòðóä*èê*-";
cin >>people[0].oklad;
cout <<"Ââåäèòå êîëè÷åñòâî îòð*áîò***ûõ ä*åé ïåðâîãî ñîòðóä*èê*-";
cin >>people[0].day;}
 
{cout<<"Ââåäèòå ÔÈÎ âòîðîãî ñîòðóä*èê*-";
cin.getline(people[1].FIO,29);
cout<<"Ââåäèòå êîä äîëæ*îñòè òðåòüåãî ñîòðóä*èê*-";
cin >>people[1].cod;
cout<<"Ââåäèòå **çâ**èå äîëæ*îñòè âòîðîãî ñîòðóä*èê*-";
cin.getline(people[1].posada,14);
cout <<"Ââåäèòå îêë*ä âòîðîãî ñîòðóä*èê*-";
cin >>people[1].oklad;
cout <<"Ââåäèòå êîëè÷åñòâî îòð*áîò***ûõ ä*åé âòîðîãî ñîòðóä*èê*-";
cin >>people[1].day;}
 
 
{cout<<"Ââåäèòå ÔÈÎ òðåòüåãî ñîòðóä*èê*-";
cin.getline(people[2].FIO,29);
cout<<"Ââåäèòå êîä äîëæ*îñòè òðåòüåãî ñîòðóä*èê*-";
cin >>people[2].cod;
cout<<"Ââåäèòå **çâ**èå äîëæ*îñòè òðåòüåãî ñîòðóä*èê*-";
cin.getline(people[2].posada,14);
cout <<"Ââåäèòå îêë*ä òðåòüåãî ñîòðóä*èê*-";
cin >>people[2].oklad;
cout <<"Ââåäèòå êîëè÷åñòâî îòð*áîò***ûõ ä*åé òðåòüåãî ñîòðóä*èê*-";
cin >>people[2].day;}
 
{cout<<"Ââåäèòå ÔÈÎ ÷åòâåðòîãî ÷åòâåðòîãî-";
cin.getline(people[3].FIO,29);
cout<<"Ââåäèòå êîä äîëæ*îñòè ÷åòâåðòîãî ñîòðóä*èê*-";
cin >>people[3].cod;
cout<<"Ââåäèòå **çâ**èå äîëæ*îñòè ÷åòâåðòîãî ñîòðóä*èê*-";
cin.getline(people[3].posada,14);
cout <<"Ââåäèòå îêë*ä ÷åòâåðòîãî ñîòðóä*èê*-";
cin >>people[3].oklad;
cout <<"Ââåäèòå êîëè÷åñòâî îòð*áîò***ûõ ä*åé ÷åòâåðòîãî ñîòðóä*èê*-";
cin >>people[3].day;}}
 
 
char L1 [50]="_";
char L2 [54]="|------------------------------|--------------|-----|\n";
cout<<L1<<endl;
cout<<"|          ÔÈÎ                 | Êîä äîëæ*îñòè |Îêë*ä|\n";
cout<<L1;
 
cout<<'|';
cout.width (30);
cout<<people[0].FIO;
cout<<'|';
cout.width(15);
cout<<people[0].posada;
cout<<'|';
cout.width(5);
cout<<people[0].oklad;
cout<<'|';
cout<<L2;
 
cout<<'|';
cout.width (30);
cout<<people[1].FIO;
cout<<'|';
cout.width(15);
cout<<people[1].posada;
cout<<'|';
cout.width(5);
cout<<people[1].oklad;
cout<<'|';
cout<<L2;
 
cout<<'|';
cout.width (30);
cout<<people[2].FIO;
cout<<'|';
cout.width(15);
cout<<people[2].posada;
cout<<'|';
cout.width(5);
cout<<people[2].oklad;
cout<<'|';
cout<<L2;
 
cout<<'|';
cout.width (30);
cout<<people[3].FIO;
cout<<'|';
cout.width(15);
cout<<people[3].posada;
cout<<'|';
cout.width(5);
cout<<people[3].oklad;
cout<<'|';
cout<<L2;
return 0;
}
}
Br8k
1 / 1 / 0
: 22.10.2012
: 42
23.10.2012, 00:25     #6
XAVOK
declaration terminated incorrectly
, , ( !)
++ int- , .
..

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
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
#include "stdafx.h"
#include "iostream"
 
using namespace std;
 
struct WORKER
{
    char FIO[30];//  //
    int cod;// //
    char posada[15];// //
    float oklad;////
    int day;//  //
};
 
void main()
{
    WORKER people[4];
    //int day(m);
    setlocale(LC_ALL, "Russian");
    {
        {
            cout<<"   -";
            cin.getline(people[0].FIO,29);
            cout<<"    -";
            cin >>people[0].cod;
            cout<<"    -";
            cin.getline(people[0].posada,14);
            cout <<"   -";
            cin >>people[0].oklad;
            cout <<"     -";
            cin >>people[0].day;
        }
 
        {
            cout<<"   -";
            cin.getline(people[1].FIO,29);
            cout<<"    -";
            cin >>people[1].cod;
            cout<<"    -";
            cin.getline(people[1].posada,14);
            cout <<"   -";
            cin >>people[1].oklad;
            cout <<"     -";
            cin >>people[1].day;
        }
 
 
        {
            cout<<"   -";
            cin.getline(people[2].FIO,29);
            cout<<"    -";
            cin >>people[2].cod;
            cout<<"    -";
            cin.getline(people[2].posada,14);
            cout <<"   -";
            cin >>people[2].oklad;
            cout <<"     -";
            cin >>people[2].day;
        }
 
    
        {
            cout<<"   -";
            cin.getline(people[3].FIO,29);
            cout<<"    -";
            cin >>people[3].cod;
            cout<<"    -";
            cin.getline(people[3].posada,14);
            cout <<"   -";
            cin >>people[3].oklad;
            cout <<"     -";
            cin >>people[3].day;
        }
    }
 
 
    char L1 [50]="_";
    char L2 [55]="|------------------------------|--------------|-----|\n";
    cout<<L1<<endl;
    cout<<"|                           |   ||\n";
    cout<<L1;
     
    cout<<'|';
    cout.width (30);
    cout<<people[0].FIO;
    cout<<'|';
    cout.width(15);
    cout<<people[0].posada;
    cout<<'|';
    cout.width(5);
    cout<<people[0].oklad;
    cout<<'|';
    cout<<L2;
 
    cout<<'|';
    cout.width (30);
    cout<<people[1].FIO;
    cout<<'|';
    cout.width(15);
    cout<<people[1].posada;
    cout<<'|';
    cout.width(5);
    cout<<people[1].oklad;
    cout<<'|';
    cout<<L2;
 
    cout<<'|';
    cout.width (30);
    cout<<people[2].FIO;
    cout<<'|';
    cout.width(15);
    cout<<people[2].posada;
    cout<<'|';
    cout.width(5);
    cout<<people[2].oklad;
    cout<<'|';
    cout<<L2;
 
    cout<<'|';
    cout.width (30);
    cout<<people[3].FIO;
    cout<<'|';
    cout.width(15);
    cout<<people[3].posada;
    cout<<'|';
    cout.width(5);
    cout<<people[3].oklad;
    cout<<'|';
    cout<<L2;
}
p.s. , !
MoreAnswers
37091 / 29110 / 5898
: 17.06.2006
: 43,301
24.10.2012, 23:01    
:

C++
C++
C++



:
XAVOK
: n/a
24.10.2012, 23:01     #7
, .
Yandex
24.10.2012, 23:01    

: 05:43. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
@Mail.ru