1. a,b,c 1000 9999. .
#include <iostream>
#include <conio.h>
void main()
{
using namespace std;
int a,b,c,s,max,d; //
cout<<"Enter a,b,c:";
cin>>a>>b>>c; //
//
if ((a<1000 || a>9999)||(b<1000 || b>9999)||(c<1000 || c>9999))
//
cout<<"All numbers must be between 1000 and 9999"<<endl;
else { // ,
s=a/1000+ a/100%10 + a/10%10 + a%10; // a
max=s; // max
d=a; // d
s=b/1000+ b/100%10 + b/10%10 + b%10; // b
// b
if (s>max) {
max=s; // , max
d=b; // ' b d
}
s=c/1000+ c/100%10 + c/10%10 + c%10; // c
// c
if (s>max) {
max=s; // , max
d=c; // ' c d
}
// d , max
//
cout<<"Number with max sum of digits:"<<d<<endl;
cout<<"Sum of digits is "<<max<<endl;
}
_getch();
}
2. a,b,c,d. ³, , . .
#include <iostream>
#include <conio.h>
void main()
{
using namespace std;
int a,b,c,d; //
cout<<"Enter a,b,c,d:";
in>>a>>b>>c>>d; //
if (b==c && c==d && a!=b)
cout<<"Number that differed is "<<a;
else if (a==c && c==d && b!=a)
cout<<"Number that differed is "<<b;
else if (a==b && a==d && a!=c)
cout<<"Number that differed is "<<c;
else if (a==b && a==c && a!=d)
cout<<"Number that differed is "<<d;
else
cout<<"Three of numbers must be equal!"<<endl;
_getch();
}
3. Ͳ
- ? ?
- ?
- -?
- if/else ++?
- if/else?
- if?
- ++ k ?
- ? ?
- ? ?
- ++ ? .
- ++?
- goto?
|
|
1. .
2. .
3. -.
4. ++ .
5. .
6. ϳ .
5. ˲
1. ., . . - . - . - 1992. 272 .
2. ., ., . . . - . - . - 1988. 512 .
3. . . ++. .: , 1997. 320
4. . C++. . .-.-., . 2003. 800 .
5. . . . . ( ). -: . 2006. 439 .
6. ²Ͳ
,
1) ( ) . ( ).
2) m, n n, m.
3) 2 +b* +=0 , b, . .
4) (x,y) , : x2+y2£r2 y³0.
5) 1, b1, 1, 2, b2, 2. , : 1*+b1*=1 2*+b2*y=2 , .
6) .
7) .
8) 10 .
9) , 10 .
10) , 5. 4 , 5.
11) 10 䒺 . (ʳ 10).
12) .
13) x, y, z
14) , 7. 3 , 7.
|
|
15) , .
16) x, y, z
17) x, y, z
18) 䒺 . ij , 10.
19) , . :
20) x, y, z, s
21) x, y, z
22) 10 . .
23) , 8. 4 , 8.
24) . , ASCII- 132.