( ENTER). <conio.h>.
char ch=getch(); // .
char ch=getche(); // .
8.6. / ++
/ ++, .
iostream.h :
extern istream_withassign _Cdecl cin; //
extern ostream_withassign _Cdecl cout; //
extern ostream_withassign _Cdecl cerr; //
extern ostream_withassign _Cdecl clog; //
. : , , , .
cin >> v; //
cout << v; //
cout . , , :
#include <iostream..h>
void main(void)
{
cout << Hello, world!;
}
<< >> , , :
cout << x+y = << x+y <<; x&y = << (x&y) << \n;
. . cin.
int i;
float y;
cin >> i >> f;
, - setf, unsetf.
unsigned v =12345;
cout << "Before: " << v << endl;
cout.setf(cout.hex); //
cout << "After: " << v << endl;
Iomanip.h,
cout << "In hexadecimal v == " << hex << v << endl;
cout << "In decimal v == " << dec << v << endl;
ends
endl
oct 8-
: cout.width(8); .
. . . , .
# include <stdio.h>
|
|
# include <conio.h>
void main (void) {
int worker1, worker2, worker3; //-
int weight1, weight2, weight3; //
char ch;
float cost; //
int num, w; //
clrscr();
weight1 = weight2 = weight3 = 0;
printf(" \n");
scanf ("%d %d %d",&worker1,&worker2,&worker3);
printf(" 1 . \n");
scantf("%f",&cost);
for(;;) {
printf(". \n");
scanf("%d %d",&num,&w);
switch (num) {
case 1:
weight1 += w;
break;
case 2:
weight2 += w;
break;
case 3:
weight3 += w;
break;
default:
printf(" \n");
}
printf(" q\n");
ch = getche();
if (ch == 'q')
break;
}
printf(" \n");
printf("1 - = %d, 2 - = %d, 3 - = %d\n, weight1,weight2,weight3);
printf(" %d \n ",weight1+weight2+ weight3);
printf(" 1- =%f\n", (float)weight1*cost/worker1);
printf(" 2- =%f\n", (float)weight2*cost/worker2);
printf(" 3- =%f\n", (float)weight3*cost/worker3);
}
- , , .
float mas [20]; - mas, 20 . 1 mas [0], mas [19].
mas [5] = 32.54;
float y = mas[5];
. , .
4 4 4
. 0 n-1, n .
.
#include <stdio.h>
void main (void) {
int i, a[10];
for (i=0; i<10; i++)
scanf (" %d",&a[i]); //
printf (" \n");
for (i=0; i<10; i++)
printf (" %5d", a[i]); // .
}