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
|
// Output Problem.cpp : main project file.
#include "stdafx.h"
#include <iostream>
using namespace std;
void function1(int &, int &);
int function2(int &);
int function3(int , int);
void function4(int, int, int);
void main()
{
int x = 9, y = 7, z = 5;
for(int i = 0; i<= 5; i++)
function1(x, y);;
z = function2 ( y );
if((z>=10 && x<7) || y!= 5)
{
y = function3(x,9);
x = function3(y,9);
}
else
z = function3(z,x);
function4(x, y, z);
system("pause");
}
void function1(int &a, int &b)
{
cout << "In function1.." <<endl;
a++;
b--;
if(a == b)
a = 2*b;
else
b = a%2;
cout << "a = : " << a << " --- b = : " << b << endl;
}
int function2( int & a )
{
cout << "In function2.." <<endl;
a+=2;
cout << "a = : " << a << endl;
return 10;
}
int function3(int a, int b)
{
cout << "In function3.." <<endl;
cout << "a = : " << a << " --- b = : " << b << endl;
return a*2+b/2;
}
void function4(int a, int b, int c)
{
cout << "In function4.." <<endl;
cout << "a = " << a << " b = " << b << " c = " << c << endl;
cout << "The Result is: " << (a+b)/c << endl;
}
|