PDA

View Full Version : نوشتن یک برنامه ++C



onbux20112011onbux
سه شنبه 03 خرداد 1390, 09:41 صبح
سلام مهندسين كامپيوتر عزيز

من دانشجوي مهندسي اجرايي پيام نور هستم و با توجه به اينكه شاغل مي باشم موفق به حضور در كلاسهاي برنامه نويسي رايانه نشدم فردا امتحان نيم ترم دارم و استاد مربوطه 11 سوال طرح كرده كه از اين 11 تا سوال در امتحان مي ايد

هيچي نمي دونم خواهشمندم كمكم كنيد حداقل 6 نمره رو بگيرم

ممنون مي شم

email: mahva_yas_1@yahoo.com


سوال 1:
write a c++ program to add two large number with 100 digits each.?
Hint; use array for each one of them

سوال 2:
write a c++ program to receive two 2*2 matrix and multiply them and show the result

سوال 3: خروجی برنامه زیر چیست
what is the output of following code snippet? Not that this code may be meaningless. What important is how to follow the logic of the code.
int x, y, z;
z = 1;
x= ++y = z++;
for (int x = 0; x<= 5; x++)
{
if ( z<4) cout << x+y*z;
z++;
if (z==4) {x=7; y=x++-z; break; }
}
cout << x << y << z;

سوال 4:
what is the output of following code snippet? Not that this code may be meaningless. What important is how to follow the logic of the code.
int x =0, y=1, z=1;
int array [20] = {0};
array [0] = x;
array [1] = y;
array [2] = z;
for (int i = 3; i < 20; i++)
array [ i ] = array [i-1] + array [i-2];
for (int i = 1; i<= 19; i++)
cout << array [ i ];

سوال 5:
what is the output of following code snippet? Not that this code may be meaningless. What important is how to follow the lohgic of the code.
char c = 'a';
char input = 'Y'
char current;
int i = 0
do {
current = cin.get();
if (current ! = c) while (i < 10) { i++; cout << a; break;}
cin >> current;
cin >> input;
if (input == 'Y') continue;
} while (input == 'Y')

سوال 6:
what errors are in the following code snippet? (compile and run time errors)
int x , switch = 0;
int[4] array;
for ( i=0; i< 10, i++) {
cout << i;
int k = switch;
x = switch++;
j - = 1;
wile (switch/x) cout << switch;
if ( i=3 ) cout << i / ( 20 + 1 = (x * switch))
array [ i ] = x;
cout << i;
int j = 9;
cout << " The value of k is << k;
switch (k) { case 0: cout << "*"; case 1: cout << "**"; break; default: ;}

سوال 7:
what is the ourput of following code snippet? Not that this code may be meaningless. What important is how to follow the logic of the code.

for (int i = 0; i<5; i++)
{
if ( x == 0 ) cout << " The Program Starts....." << endl;
switch ( i % 2 )
{
case 0 : for ( int k = 0; k <= i; k++) cout << "*"; cout << endl; break;
case 1 : for ( int k = 0; k < i; k++) cout << "**"; cout << endl; break;
}
}
cout << " Program Ended Successfully....";

سوال 8:
write a c++ program to receive score of 10 students in mathematics, Chemistry, Physics and Biology and draw a line chart of every course average. sample output can be as following:

Enter the Student Mathematics score 1:13
Enter the Student Chemistry score 1:18
Enter the Student Physics score 1:19.5
Enter the Student Biology score 1:15.75
...........
Average in Mathematics: 18
Average in Chemistry: 13
Average in Physics: 17.25
Average in Biology:12

سوال 9:
what is the output of following code snippet? Not that this code may be meaningless. What important is how to follow the logic of the code.
int x =0, y=1, z=1;
int array [20] = {0};
array [0] = x;
array [1] = y;
array [2] = z;
for (int i = 3; i < 20; i++)
array [ i ] = array [i-1] + array [i-2];
for (int i = 1; i<= 19; i++)
cout << array [ i ];