̳ ,
-
_________ ..
_____ ___________ 2011 .
-
5.05010301
___________ .. ____
____________2011 . ___ _______200_.
_____ / ../
____________ ..
..
. - 2011 .
, .
, , : , , , , . ( , , , ), .
ᒺ : , , ᒺ
, , , , , .
, , ,
270, 90 .
. ᒺ . .
ϳ :
.
ϳ :
.
1
: .
: ,
.
, . :
|
|
1. ;
2. ʳ;
3. ˳;
4. ;
5. ;
6. ;
7. ;
8. ;
9. ;
10. .
ճ
1. .
2. .
3. .
4. , .
5. .
6. .
:
#include <stdio.h>
main()
{
int d,kv;
char im[10],fio[20],vul[20];
printf( );
printf( ?);
scanf(%s,&im);
scanf(%s,&fio);
printf(/n %s %s, ?, im, fio);
scanf(%s,&vul);
scanf(%d,&d);
scanf(%d,&kv);
printf(/n %s %s, %s %d, im, fio, vul,d);
}
1. ?
2. ?
3. ?
4. ?
2
: .
: , .
˳: .., .. , ++
:
1. , . . .
2. .
1
1.
2. .
3. . .
2
1.
2. .
3. . .
3
1.
2. .
3. . .
4
1.
2. .
3. . .
5
1.
2. .
3. . .
6
1.
2. .
3. . , . , .
7
1.
2. .
3. , . , 璺 .
8
1.
2. .
3. =400 R. .
9
1.
2. , 25, .
3. . .
10
1.
2. , 15, .
3. R.
|
|
#include <math.h>
#include <stdio.h>
#include <conio.h>
void main()
{
/* http://nataliya.kiev.ua */
float ,x,y;
printf("Enter x:");
scanf("%f",&x);
printf("Enter :");
scanf("%f",&a);
y=sqrt(25-pow(x,2))+2*a/(x-3);
printf("Y=%f",y);
getch();
}
1. ?
2. ?
3. ?
3
: - .
: - .
˳: .., .. , ++.
Char | Strcat | (Char, constant char) | ǒ . |
Int | Strcmp | (Constant, constant) | . |
Char | Strcpy | (Char, constant char) | . |
Char | Strlen | (Constant, char *a char) | ϳ . |
Char | Strchr | (Constant char *s, int c) | . |
Size_t | Strspn | (Const char *s, constant *set) | s set. |
# include <string.h>
. 12 , . dz 䳿:
1. .
2. .
3. . .
4. .
5. .
1 ;
2 ʳ;
3 ˳;
4 ;
5 ;
6 ;
7 ;
8 ;
9 ;
10 .
1. ?
2. ?
3. ?
4. ?
4
: .
: .
˳: .., .. , ++
. . .
1
1. : , , . .
2. . , , .
2
1 : , , . ϳ .
2 , .
3
1 : , , . ϳ .
2 , .
4
1 : , , . ϳ .
2 , .
5
1 : , , . ϳ .
2 , .
6
1 : , , . .
|
|
2 , ..
7
1 : , , . .
2 , .
8
1 : , , . .
2 , .
9
1 : , , . .
2 , .
10
1 : , , . .
2 , ..
#include <math.h>
#include <stdio.h>
#include <conio.h>
void main()
{
float a,x,y;
printf("Enter x:");
scanf("%f",&x);
printf("Enter a:");
scanf("%f",&a);
if ((25-x*x<0)|(x= =3))
printf("Error");
else
{
y=sqrt(25-pow(x,2))+2*a/(x-3);
printf("Y=%f",y);
}
getch();
}
1. if?
2. switchcase?
3. break?
5
: .
: .
˳: .., .. , ++
switch . :
switch () {
case constant1:
break;
case constant2:
break;
case constant3:
break;
...
case constantN:
break;
default
}
.
Enter
" ʳ ".
ճ
1. .
;
;
;
.
3-4 .
2. .
;
;
. ;
3-4 .
3. , .
;
;
;
;
3-4 .
4. .
( );
( );
( ).
5.
; ( )
;
. ( )
3-4 .
6. :
; ( )
³ ;
|
|
;
.( )
3-4 .
7. .
;
;
.
3-4 .
8. .
;
;
.
3-4 .
1. switch.
2. default?
3. break;?
6
: .
: .
˳: .., .. , ++
. . .
1
1. .
2. 5 , .
3. 9 , .
2
1 .
2 5 , .
3 9 , .
3
1. .
2. 5 , .
3. 9 , .
4
1. 5 .
2. 5 , .
3. 9 , .
5
1. .
2. 5 , .
3. 9 , .
6
1. .
2. 5 , .
3. 9 , .
7
1. .
2. 5 , .
3. 9 , .
8
1. .
2. 5 , .
3. 9 , .
9
1. , 20, .
2. 5 , .
3. 9 , 䒺 .
10
1. , 10, .
2. 5 , .
3. 9 , .
#include <stdio.h>
#include <conio.h>
void input(int *a,iht n){
int i;
for(i=0;i<n;i++){
printf( % :,+1);
scanf("%d",&a[i]);
}
}
void main(){
int a[10],i;
input(a,10);
for(i=0;i<10;i++)
printf("%5i",a[i]);
}
1. for?
2. do while?
3. while...?
7.
:
|
|
: .
˳: .., .. , ++
. . .
1
1. 10 .
2. 5 , .
3. 9 , .
2
1. 10 .
2. 5 , .
3. 9 , .
3
1. 10 .
2. 5 , .
3. 9 , .
4
1. , 6 25, 24, 23, 22, 21, 20, .
2. 5 , .
3. 9 , 䒺 .
5
1. 10 .
2. 5 , .
3. 9 , .
6
1. 10 .
2. 5 , .
3. 9 , .
7
1. , 15,14, 13, 12,11, 10, .
2. 5 , .
3. 9 , .
:
void main()
{
int i;
i = 1;
while (i <= 20)
{
printf(i=%d,i);
i = i + 1;
}
return 0;
}
1. ?
2. ?
3. ?
8.
: .
: .
˳: .., .. , ++
. . .
1
1. 10 .
2. 5 , .
3. 9 , .
2
1. 10 .
2. 5 , .
3. 9 , .
3
1. 10 .
2. 5 , .
3. 9 , .
4
1. , 6 25, 24, 23, 22, 21, 20, .
2. 5 , .
3. 9 , 䒺 .
5
1. 10 .
2. 5 , .
3. 9 , .
6
1. 10 .
2. 5 , .
3. 9 , .
7
1. , 15,14, 13, 12,11, 10, .
2. 5 , .
3. 9 , .
:
void main()
{
int i;
i = 1;
while (i <= 20)
{
printf(i=%d,i);
i = i + 1;
}
return 0;
}
4. ?
5. ?
6. ?
9
: .
: .
˳: .., .. , ++
. . .
1
1. 5 , .
2. 9 , .
2
1. 5 , .
2. 9 , .
3
1. 5 , .
2. 9 , .
4
1. 5 , .
2. 9 , .
5
1. 5 , .
2. 9 , .
6
1. 5 , .
2. 9 , .
7
1. 5 , .
2. 9 , .
8
1. 5 , .
2. 9 , .
9
1. 5 , .
2. 9 , 䒺 .
10
1. 5 , .
2. 9 , .
#include <stdio.h>
#include <conio.h>
void main()
{
int a[10][10],I,j,s,*ptr;
randomaiz();
printf("En--ter: a");
for (i=1; i<=10;i++)
{ for (j=1; j<=10;j++)
{
a[i][j]=1+random(98); printf(%5d,a[i][j]); }printf(\n\r);}
for (i=1; i<=10;i++)
{ s=o; ptr=a[i];
for (j=1; j<=10;j++)
{
s+=*ptr; ptr++;}
printf(%5d,s);}
}
4. ?
5. 䳿 ?
6. ?
10
: .
: .
˳: .., .. , ++
. . .
1
1.
2. .
2
1.
2. .
3
1.
2. .
4
1.
2. .
5
1.
2. .
6
1.
2. .
7
1.
2. .
8
1.
2. .
9
1.
2. , 25, .
10
1.
2. , 15, .
/* ! */
#define NAME "MEGATHINK, INC."
#define ADDRESS "10 Megabuck Plaza"
#define PLACE "Megapolis, CA 94904"
starbar();
main()
{
starbar();
printf("%s\n", NAME);
printf(" %s\n", ADDRESS);
printf("%s\n", PLACE);
starbar();
}
/* starbar() */
#include
#define LIMIT 65
starbar()
{ int count;
for (count = 1; count <= LIMIT; count++)
putchar('*');
putchar('\n');
}
:
***********************************************************
MEGATHINK, INC 10 Megabuck Plaza Megapolis, CA 94904
***********************************************************
1. ?
2. ?
3. ?
11
: .
: .
˳: .., .. , ++
, . . .
, . 6 ,
.
#include <stdio.h>
int fact(k);
int k;
{
if(k==1)
return(1);
else
return(k*fact(k-1));
}
main()
{
int i=1;
printf(" \n");
while(i<7)
{
printf("%d!= %d\n",i, fact(i));
i=i+1;
}
}
ճ
1. ³ .
2. .
3. :
a. n! n=10
b. (a+b)! a=3, b=6
c. (2+n)! n=8
d. (c/d)! c=9, d=3
e. (a*a)! a=4
f. (7*t)! t=2
g. n!+m! n=4,m=6
1. ?
2. .
12
: .
: , , .
˳: .., .. , ++
. . .
1
1.
2. .
2
1.
2. .
3
1.
2. .
4
1.
2. .
5
1.
2. .
6
1.
2. .
7
1.
2. .
8
1.
2. .
9
1.
2. , 25, .
10
1.
2. , 15, .
/* y=t**n*/
int power(t,n);
int t,n;
{
int p=1;
while(n!=0)
{
if(n%2!=0) p=p*t;
n=n/2;
t=t*t;
}
return(p);
}
/*ϳ - */
#include <stdio.h>
main()
{
int a,n;
printf(" a,n \n");
scanf("%d %d",&a,&n);
printf("%d %d = %d",a,n
power(a,n));
}
1. ?
2. ?
3. ?
13
: - .
: -.
˳: .., .. , ++.
, , . , . . , . , .
-. . .
1
1. 5 , .
2. 9 , .
2
1. 5 , .
2. 9 , .
3
1. 5 , .
2. 9 , .
4
1. 5 , .
2. 9 , .
5
1. 5 , .
2. 9 , .
6
1. 5 , .
2. 9 , .
7
1. 5 , .
2. 9 , .
8
1. 5 , .
2. 9 , .
9
1. 5 , .
2. 9 , 䒺 .
10
1. 5 , .
2. 9 , .
#include <stdio.h>
#include <conio.h>
void input(int *a,int n)
{int i;
for(i=0;i<n;i++)
{printf( % :,+1);
scanf("%d",&a[i]); }}
void main(){
int a[10],i;
input(a,10);
for(i=0;i<10;i++)
printf("%5i",a[i]);}
1. ?
2. ?
3. -?
14
: .
: .
˳: .., .. , ++.
, , 䳿:
;
;
.
, ' . ' () , , ' ( ).). . . () - . , . ³, .
:
_(* _ )(_)
_ ;
_ ;
_ .
:
int (*pf)(); //
int (*pf)(void); // ,
int (*pf)(int, char*); //
:
(* _ )( _ _);
_ , * .
.
1. .
2. .
3. .
4. ³ .
1.
, [a, b] .
#include "stdafx.h"
#include <iostream>
using namespace std;
// () :
/* rectangle() double, :*/
/*pf double, double*/
/*a, b , double*/
double rectangle(double(*pf)(double), double a, double b);
/* ratio() double, double*/
double ratio(double x);
/* cos4_2() double, double*/
double cos4_2(double v);
int _tmain(int argc, _TCHAR* argv[]){
double a,b,c;
printf("\n :");
printf("\na= ");
scanf("%lf",&a);
printf("\nb= ");
scanf("%lf",&b);
c=rectangle(ratio,a,b);
printf(" = %f\n",c);
printf(" = %f\n",rectangle(cos4_2,a,b));
system("pause");
return 0;
}
double rectangle(double(*pf)(double), double a, double b){
/* */
int N, i;
double h,s=0.0;
printf("\n : N= ");
scanf("%d",&N);
printf("\na= ");
h=(b-a)/N; //
for (i=0;i<N;i++)
s+=pf(a+h/2+i*h);
return h*s;
}
double ratio(double x) { //ϳ
double z; //
z=x*x+1;
return x/(z*z);
}
double cos4_2(double v){ // ϳ
double w; //
w=cos(v);
return 4*w*w;
}
2.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
//
void f1(); // () f1
void f2(); // () f2
int _tmain(int argc, _TCHAR* argv[]) {
void (*ptr)(); //ptr
f2(); // f2
ptr=f2;// f2
(*ptr)();
// f2
ptr=f1;// f1
(*ptr)();
// f1
ptr(); // f1
system("pause");
return 0;
}
// f1 f2
void f1() {
cout << " f1\n";
}
void f2() {
cout << " f2\n";
}
1. ?
2. ?
3. ? , ?
4. '? , ?
5. ? , ?
15
: .
: .
˳: .., .. , ++
. . .
1
1. 5 , .
2. 9 , .
2
1. 5 , .
2. 9 , . ³ .
3
1. 5 , , .
2. 9 , .
4
1. 5 , , .
2. 9 , .
5
1. 5 , , .
2. 9 , .
6
1. 5 , .
2. 9 , . ³ .
7
1. 5 , .
2. 9 , .
8
1. 5 , , .
2. 5 , , .
9
1. 9 , .
2. 9 , .
10
1. 9 , .
2. 5 , , .
#include <stdio.h>
#include <conio.h>
void main()
{
int a[10],t,i,x;
randomaiz();
printf("En--ter: a");
for (i=1; i<=10;i++) {
a[i][j]=1+random(98);
printf(%5d,a[i][j]); }
printf(\n\r);}
do {
t=1;
for (i=1; i<=9;i++)
if(a[i]>a[i+1]) { x=a[i];
a[i]=a[i+1];a[i+1]=x;t=0 }}
while(t==0);
for (i=1; i<=10;i++)
printf(%5d,a[i]); }
1. .
2. .
3. ?
16
: .
: