My work as of ...
3/06/08
foreloop2
#include
#include
using namespace std;
int main()
{
int z;
cout << "What array chart do you want to see?\n";
cout << "1)Addition\n";
cout << "2)Subtraction\n";
cout << "3)Multiplication\n";
cout << "Enter a choice: ";
cin >> z;
switch (z)
{
case 1:
{
int myArray1010;
for(int i = 0; i <= 9; ++i)
{
for (int t = 0; t <= 9; ++t)
{
myArrayit = i+t; //this will give each element a value
}
}
for (int i=0; i<=9; ++i)
{
for (int t = 0; t <=9; ++t)
{
// cout << setw(3) <it << " ";
cout << setw(3) <it << " ";
}
cout << endl;
}
system("pause");
return 0;
}
break;
case 2:
{
int myArray1010;
for(int i = 0; i <= 9; ++i)
{
for (int t = 0; t <= 9; ++t)
{
myArrayit = i-t;//this will give each element a value
}
}
for (int i=0; i<=9; ++i)
{
for (int t = 0; t <=9; ++t)
{
// cout << setw(3) <i t << " ";
cout << setw(3) <it << " ";
}
cout << endl;
}
system("pause");
return 0;
}
break;
case 3:
{
int myArray1010;
for(int i = 0; i <= 9; ++i)
{
for (int t = 0; t <= 9; ++t)
{
myArrayit = i*t;//this will give each element a value
}
}
for (int i=0; i<=9; ++i)
{
for (int t = 0; t <=9; ++t)
{
//cout << setw(3) <i t << " ";
cout << setw(3) <it << " ";
}
cout << endl;
}
system("pause");
return 0;
}
break;
default:
cout << "not a valid entry\n\n";
break;
}
system("pause");
}
/*********
What array chart do you want to see?
1)Addition
2)Subtraction
3)Multiplication
Enter a choice: 2
0 -1 -2 -3 -4 -5 -6 -7 -8 -9
1 0 -1 -2 -3 -4 -5 -6 -7 -8
2 1 0 -1 -2 -3 -4 -5 -6 -7
3 2 1 0 -1 -2 -3 -4 -5 -6
4 3 2 1 0 -1 -2 -3 -4 -5
5 4 3 2 1 0 -1 -2 -3 -4
6 5 4 3 2 1 0 -1 -2 -3
7 6 5 4 3 2 1 0 -1 -2
8 7 6 5 4 3 2 1 0 -1
9 8 7 6 5 4 3 2 1 0
Press any key to continue . . .
*******/
3/4/08
nested loop
#include
using namespace std;
int rows, columns;
char theChar;
int main()
{
cout << "How many rows?\t";
cin >> rows;
cout << "How many columns?\t";
cin >> columns;
cout << "What character?\t";
cin >> theChar;
//loop declaration
for (int i = 0; i < columns; i++)
{
for (int j = 0; j < columns; j++)
cout << theChar;
cout << "\n";
}
system ("pause");
}
/**********
How many rows? 6
How many columns? 12
What character? u
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
uuuuuuuuuuuuu
Press any key to continue . . .
***********/
null loop
#include
using namespace std;
int main()
{
for (int i=0; i<5; cout << "i = " << i++ << endl)
{
; //This is a null statement
//all the action is done in the header of the loop
}
system ("pause");
}
/************
i = 0
i = 1
i = 2
i = 3
i = 4
Press any key to continue . . .
*********/
array
#include
#include
using namespace std;
int main()
{
int myArray1010;
for(int i = 0; i <= 9; ++i)
{
for (int t = 0; t <= 9; ++t)
{
myArrayit = i*t;//this will give each element a value
}
}
for (int i=0; i<=9; ++i)
{
for (int t = 0; t <=9; ++t)
{
// cout << setw(3) <it << " ";
cout << setw(3) <it << " ";
}
cout << endl;
}
system("pause");
return 0;
}
/******
0 0 0 0 0 0 0 0 0 0
0 1 2 3 4 5 6 7 8 9
0 2 4 6 8 10 12 14 16 18
0 3 6 9 12 15 18 21 24 27
0 4 8 12 16 20 24 28 32 36
0 5 10 15 20 25 30 35 40 45
0 6 12 18 24 30 36 42 48 54
0 7 14 21 28 35 42 49 56 63
0 8 16 24 32 40 48 56 64 72
0 9 18 27 36 45 54 63 72 81
Press any key to continue . . .
*******/
3/3/08
last chance gas
if then else loop
#include
using namespace std;
int a;
int b;
int main(){
cout << "Enter a value for a: \n";
cin >> a;
cout << "Enter a value for b: \n";
cin >> b;
if (a > b){
cout << a << " is less than " << b <
}else if(a < b){
cout << a << " is less than " << b <
} else {
cout << a << " is equal to " << b <
}
system("pause");
}
/*****
Enter a value for a:
85
Enter a value for b:
98
85 is less than 98
Press any key to continue . . .
*****/
/******
Enter a value for a:
7
Enter a value for b:
4
7 is less than 4
Press any key to continue . . .
******/
/*******
Enter a value for a:
7
Enter a value for b:
7
7 is equal to 7
Press any key to continue . . .
*******/
random number generator
NumberGuess
2/28/08
Average Rainfall
#include
using namespace std;
float Findaveragerainfall(float a, float m, float j)
{
float y=((a+m+j)/3);
return y;
}
int main()
{
char doAgain;
doAgain = 'y';
while (doAgain == 'y')
{
float a, m, j, y;
cout << "What was the rainfall in April?\n";
cin >> a;
cout << "What was the rainfall in May?\n";
cin >> m;
cout << "What was the rainfall in June?\n";
cin >> j;
y=Findaveragerainfall(a, m, j);
cout << "Rainfall in April was "<< a <<".\n";
cout << "Rainfall in May was "<< m <<".\n";
cout << "Rainfall in June was "<< j <<".\n";
cout << " \n";
cout <<"The average rainfall was "<< y <<".\n";
cout << "Would you like to recalculate the rainfall for those months?\ny or n:\n";
cin >> doAgain;
}
system("pause");
}
/*************
What was the rainfall in April?
23
What was the rainfall in May?
23
What was the rainfall in June?
23
Rainfall in April was 23.
Rainfall in May was 23.
Rainfall in June was 23.
The average rainfall was 23.
Would you like to recalculate the rainfall for those months?
y or n:
y
What was the rainfall in April?
45
What was the rainfall in May?
45
What was the rainfall in June?
45
Rainfall in April was 45.
Rainfall in May was 45.
Rainfall in June was 45.
The average rainfall was 45.
Would you like to recalculate the rainfall for those months?
y or n:
y
What was the rainfall in April?
123
What was the rainfall in May?
123
What was the rainfall in June?
123
Rainfall in April was 123.
Rainfall in May was 123.
Rainfall in June was 123.
The average rainfall was 123.
Would you like to recalculate the rainfall for those months?
y or n:
n
Press any key to continue . . .
*************/
2/27/08
2/26/08
MPG
#include
using namespace std;
float Findmilespergallon(float m, float g)
{
float mpg=(m/g);
return mpg;
}
int main()
{
char doAgain;
doAgain = 'y';
while (doAgain == 'y')
{
system("COLOR 5B");
float m, g, mpg;
cout << "Welcome! This program finds miles per gallon.\n";
cout << "Type in the miles you have driven.\n";
cin >> m;
cout << "Type in the number of gallons of gas it took to drive that far.\n";
cin >> g;
cout<<"\n Finding miles per gallon.()\n";
mpg=Findmilespergallon(m, g);
cout <<"Miles per gallon was "<< mpg <<"\n";
cout << "Would you like to enter another car?\ny or n:\n";
cin >> doAgain;
}
system("pause");
}
/*************
Welcome! This program finds miles per gallon.
Type in the miles you have driven.
60
Type in the number of gallons of gas it took to drive that far.
6
Finding miles per gallon.()
Miles per gallon was 10
Would you like to enter another car?
y or n:
y
Welcome! This program finds miles per gallon.
Type in the miles you have driven.
50
Type in the number of gallons of gas it took to drive that far.
5
Finding miles per gallon.()
Miles per gallon was 10
Would you like to enter another car?
y or n:
y
Welcome! This program finds miles per gallon.
Type in the miles you have driven.
120
Type in the number of gallons of gas it took to drive that far.
12
Finding miles per gallon.()
Miles per gallon was 10
Would you like to enter another car?
y or n:
n
Press any key to continue . . .
**************/
2/25/08
2/15/08
2/14/08
Imperial to Metric Converter
#include
using namespace std;
float Convertfeettocentimeters(float y)
{
float ft2cm=(y*30.48);
return ft2cm;
}
float Convertcentimeterstofeet(float y)
{
float cm2ft=((y*.3937)*12);
return cm2ft;
}
float Convertmilestokilometers(float y)
{
float m2km=(y*1.609);
return m2km;
}
float Convertkilometerstomiles(float y)
{
float km2m=(y* 0.6215);
return km2m;
}
float Convertsquareinchestosquarecentimeters(float y)
{
float sin2scm=(y*6.452);
return sin2scm;
}
float Convertsquarecentimeterstosquareinches(float y)
{
float scm2sin=(y*0.155);
return scm2sin;
}
float Convertkilogramstopounds(float y)
{
float kg2lbs=(y*2.2046);
return kg2lbs;
}
float Convertpoundstokilograms(float y)
{
float lbs2kg=(y*0.4536);
return lbs2kg;
}
float Convertgallonstoliters(float y)
{
float gl2l=(y*4.54);
return gl2l;
}
float Convertliterstogallons(float y)
{
float l2gl=(y*0.22 );
return l2gl;
}
float Convertsquaremilestosquarekilometers(float y)
{
float sm2skm=(y*2.590);
return sm2skm;
}
float Convertsquarekilometerstosquaremiles(float y)
{
float skm2sm=(y*0.3861);
return skm2sm;
}
int main()
{
int z, y;
float ft, cm, m, km, sin, scm, kg, lbs, gl, l, sm, skm;
cout << "Welcome! This is an imperial to metric converter.\n";
cout << "Do you want to ...\n";
cout << "1)Convert feet to centimeters.\n";
cout << "2)Convert centimeters to feet.\n";
cout << "3)Convert miles to kilometers.\n";
cout << "4)Convert kilometers to miles.\n";
cout << "5)Convert square inches to square centimeters.\n";
cout << "6)Convert square centimeters to square inches.\n";
cout << "7)Convert kilograms to pounds.\n";
cout << "8)Convert pounds to kilograms.\n";
cout << "9)Convert gallons to liters.\n";
cout << "10)Convert liters to gallons.\n";
cout << "11)Convert square miles to square kilometers.\n";
cout << "12)Convert square kilometers to square miles.\n";
cout << "Enter a choice. (1,2,3 etc.)\n";
cin >> z;
switch (z)
{
case 1:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert feet to centimeters()\n";
cm=Convertfeettocentimeters(y);
cout <<"CM was set to "<< cm <<"\n";
break;
case 2:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert centimeters to feet()\n";
ft=Convertcentimeterstofeet(y);
cout <<"FT was set to "<< ft <<"\n";
break;
case 3:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert miles to kilometers()\n";
km=Convertmilestokilometers(y);
cout <<"KM was set to "<< km <<"\n";
break;
case 4:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert kilometers to miles()\n";
m=Convertkilometerstomiles(y);
cout <<"M was set to "<< m <<"\n";
break;
case 5:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert square inches to square centimeters()\n";
scm=Convertsquareinchestosquarecentimeters(y);
cout <<"SCM was set to "<< scm <<"\n";
break;
case 6:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert square centimeters to square inches()\n";
sin=Convertsquarecentimeterstosquareinches(y);
cout <<"SIN was set to "<< sin <<"\n";
break;
case 7:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert kilograms to pounds()\n";
lbs=Convertkilogramstopounds(y);
cout <<"LBS was set to "<< lbs <<"\n";
break;
case 8:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert pounds to kilograms()\n";
kg=Convertpoundstokilograms(y);
cout <<"KG was set to "<< kg <<"\n";
break;
case 9:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert gallons to liters()\n";
l=Convertgallonstoliters(y);
cout <<"L was set to "<< l <<"\n";
break;
case 10:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert liters to gallons()\n";
gl=Convertliterstogallons(y);
cout <<"GL was set to "<< gl <<"\n";
break;
case 11:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert square miles to square kilometers()\n";
skm=Convertsquaremilestosquarekilometers(y);
cout <<"SKM was set to "<< skm <<"\n";
break;
case 12:
cout << "enter the value you want to convert:\n";
cin >> y;
cout<<"\nConvert square kilometers to square miles()\n";
sm=Convertsquarekilometerstosquaremiles(y);
cout <<"SM was set to "<< sm <<"\n";
break;
default:
cout << "not a valid entry\n\n";
break;
}
system("pause");
}
/*********
Welcome! This is an imperial to metric converter.
Do you want to ...
1)Convert feet to centimeters.
2)Convert centimeters to feet.
3)Convert miles to kilometers.
4)Convert kilometers to miles.
5)Convert square inches to square centimeters.
6)Convert square centimeters to square inches.
7)Convert kilograms to pounds.
8)Convert pounds to kilograms.
9)Convert gallons to liters.
10)Convert liters to gallons.
11)Convert square miles to square kilometers.
12)Convert square kilometers to square miles.
Enter a choice. (1,2,3 etc.)
6
enter the value you want to convert:
10
Convert square centimeters to square inches()
SIN was set to 1.55
Press any key to continue . . .
*********/
2/12/08
TemperatureConverter
#include
using namespace std;
float ConvertCelsiustoFarenheit(float x)
{
float c2f=((x*1.8)+32);
return c2f;
}
float ConvertFarenheittoCelsius(float y)
{
float f2c=((y-32)/1.8);
return f2c;
}
int main()
{
int z, y;
float x, f, c;
cout << "Welcome! This is a temperature converter.\n";
cout << "Do you want to ...\n";
cout << "1)Convert Celsius to Farenheit.\n";
cout << "2)Convert Farenheit to Celsius.\n";
cout << "Enter a choice. (1 or 2)\n";
cin >> z;
switch (z)
{
case 1:
cout << "enter the temperature you want to convert:\n";
cin >> x;
cout<<"\nCalling Convert Celsius to Farenheit()\n";
f=ConvertCelsiustoFarenheit(x);
cout <<"F was set to "<< f <<"\n";
break;
case 2:
cout << "enter the temperature you want to convert:\n";
cin >> y;
cout <<"\nCalling Convert Farenheit to Celsius()\n";
c=ConvertFarenheittoCelsius(y);
cout <<"C was set to "<< c <<"\n";
break;
default:
cout << "not a valid entry\n\n";
break;
}
system("pause");
}
/*******
Welcome! This is a temperature converter.
Do you want to ...
1)Convert Celsius to Farenheit.
2)Convert Farenheit to Celsius.
Enter a choice. (1 or 2)
1
enter the temperature you want to convert:
0
Calling Convert Celsius to Farenheit()
F was set to 32
Press any key to continue . . .
Welcome! This is a temperature converter.
Do you want to ...
1)Convert Celsius to Farenheit.
2)Convert Farenheit to Celsius.
Enter a choice. (1 or 2)
2
enter the temperature you want to convert:
67
Calling Convert Farenheit to Celsius()
C was set to 19.4444
Press any key to continue . . .
*******/
2/11/08
calcfunctions
consolecolor
#include
using namespace std;
int main()
{
system("COLOR 5B");
system("pause");
}
2/7/08
2/6/08
calcdisplay
#include
using namespace std;
int Add (int x, int y)
{
return (x+y);
}
int Multiply (int x, int y)
{
return (x*y);
}
int Divide (int x, int y)
{
return (x/y);
}
int Subtract (int x, int y)
{
return (x-y);
}
int Modulus (int x, int y)
{
return (x%y);
}
int Display (int a, int b, char zz, int c)
{
cout << " .............................................\n";
cout << " .............................................\n";
cout << " .... ....\n";
cout << " ...." << " " << a << " " << zz <<" " << b << " = " << c << ""<< " ....\n";
cout << " .... ....\n";
cout << " .............................................\n";
cout << " .............................................\n";
cout << " .... ........ ............ ......\n";
cout << " .... 1 ........ 2 ............ 3 ......\n";
cout << " .... ........ ............ ......\n";
cout << " .............................................\n";
cout << " .............................................\n";
cout << " .... ........ ............ ......\n";
cout << " ..... 4 ........ 5 ............ 6 ......\n";
cout << " .... ........ ............ ......\n";
cout << " .............................................\n";
cout << " .............................................\n";
cout << " .... ........ ............ ......\n";
cout << " .. 7 ........ 8 ............ 9 ......\n";
cout << " .... ........ ............ ......\n";
cout << " .............................................\n";
cout << " .............................................\n";
cout << " ................ ......................\n";
cout << " ................ o ......................\n";
cout << " ................ ......................\n";
cout << " .............................................\n";
cout << " .............................................\n";
cout << " .... ........ ............ ......\n";
cout << " .... + ........ - ............ = ......\n";
cout << " .... ........ ............ ......\n";
cout << " .............................................\n";
cout << " .............................................\n";
cout << " .... ........ ............ ......\n";
cout << " .. * ........ / ............ % ......\n";
cout << " .... ........ ............ ......\n";
cout << " .............................................\n";
cout << " .............................................\n";
return 0;
}
char convertOperator (int zz)
{
switch (zz)
{
case 1:
zz = '+';
break;
case 2:
zz = '-';
break;
case 3:
zz = '*';
break;
case 4:
zz = '/';
break;
case 5:
zz = '%';
break;
default:
cout << "not a valid entry\n\n";
break;
}
return zz;
}
int main()
{
cout << "Welcome to ASCII calculator\n";
int a, b, c, d, e, f, g, z, result;
cout << "enter a number:\n";
cin >> a;
cout << "enter another number:\n";
cin >> b;
c=Add(a, b);
d=Multiply(a, b);
e=Divide(a, b);
f=Subtract(a, b);
g=Modulus(a, b);
cout << "What operation do you want to do?\n";
cout << "1)Addition\n";
cout << "2)Subtraction\n";
cout << "3)Multiplication\n";
cout << "4)Division\n";
cout << "5)Modulus\n";
cin >> z;
switch (z)
{
case 1:
cout << "C was set to " << c << " in Add\n";
result=c;
break;
case 2:
cout << "F was set to " << f << " in Subtract\n";
result=f;
break;
case 3:
cout << "D was set to " << d << " in Multiply\n";
result=d;
break;
case 4:
cout << "E was set to " << e << " in Divide\n";
result=e;
break;
case 5:
cout << "G was set to " << g << " in Modulus\n";
result=g;
break;
}
Display (a, b, convertOperator (z), result);
system ("pause");
return 0;
}
/*****
Welcome to ASCII calculator
enter a number:
5
enter another number:
6
What operation do you want to do?
1)Addition
2)Subtraction
3)Multiplication
4)Division
5)Modulus
3
D was set to 30 in Multiply
.............................................
.............................................
.... ....
.... 5 * 6 = 30 ....
.... ....
.............................................
.............................................
.... ........ ............ ......
.... 1 ........ 2 ............ 3 ......
.... ........ ............ ......
.............................................
.............................................
.... ........ ............ ......
..... 4 ........ 5 ............ 6 ......
.... ........ ............ ......
.............................................
.............................................
.... ........ ............ ......
.. 7 ........ 8 ............ 9 ......
.... ........ ............ ......
.............................................
.............................................
................ ......................
................ o ......................
................ ......................
.............................................
.............................................
.... ........ ............ ......
.... + ........ - ............ = ......
.... ........ ............ ......
.............................................
.............................................
.... ........ ............ ......
.. * ........ / ............ % ......
.... ........ ............ ......
.............................................
.............................................
Press any key to continue . . .
2/5/08
operatorswitch
#include
using namespace std;
int Add(int x, int y)
{
cout <<"\nIn Add(), received A:"<< x <<" and B:" << y << "\n";
return (x+y);
}
int Multiply (int x,int y)
{
cout <<"\nIn Multiply(), received A:"<< x <<" and B:" << y << "\n";
return (x*y);
}
int Divide (int x, int y)
{
cout <<"\nIn Divide(), received A:"<< x <<" and B:" << y << "\n";
return (x/y);
}
int Subtract (int x, int y)
{
cout <<"\nIn Subtract(), received A:"<< x <<" and B:" << y<< "\n";
return (x-y);
}
int Modulus (int x, int y)
{
cout <<"\nIn Modulus(), received A:"<< x <<" and B:" << y<< "\n";
return (x%y);
}
int main()
{
int z;
cout << "What operation do you want to do?\n";
cout << "1)Addition\n";
cout << "2)Subtraction\n";
cout << "3)Multiplication\n";
cout << "4)Division\n";
cout << "5)Modulus\n";
cout << "Enter a choice: ";
cin >> z;
switch (z)
{
case 1:
int a, b, c, d ,e ,f ,g;
cout << "enter two numbers:\n";
cin >> a;
cin >> b;
cout<<"\nCalling Add()\n";
c=Add (a,b);
cout <<"C was set to "<< c <<"\n";
break;
case 2:
cout << "enter two numbers:\n";
cin >> a;
cin >> b;
cout <<"\nCalling Subtract()\n";
d=Subtract (a,b);
cout <<"D was set to "<< d <<"\n";
break;
case 3:
cout << "enter two numbers:\n";
cin >> a;
cin >> b;
cout <<"\nCalling Multiply()\n";
e=Multiply (a,b);
cout <<"E was set to "<< e <<"\n";
break;
case 4:
cout << "enter two numbers:\n";
cin >> a;
cin >> b;
cout <<"\nCalling Divide()\n";
f=Divide (a,b);
cout <<"F was set to "<< f <<"\n";
break;
case 5:
cout << "enter two numbers:\n";
cin >> a;
cin >> b;
cout <<"\nCalling Modulus()\n";
g=Modulus (a,b);
cout <<"G was set to "<< g <<"\n";
break;
default:
cout << "not a valid entry\n\n";
break;
}
system("pause");
}
/*********
What operation do you want to do?
1)Addition
2)Subtraction
3)Multiplication
4)Division
5)Modulus
Enter a choice: 3
enter two numbers:
3
4
Calling Multiply()
In Multiply(), received A:3 and B:4
E was set to 12
Press any key to continue . . .
*******/
2/4/08
operators
1/31/08
numberinput
#include
using namespace std;
int Add (int x, int y)
{
cout <<"\nIn Add(), received A:"<< x <<" and B:" << y << "\n";
return (x+y);
}
int Multiply (int x,int y)
{
cout <<"\nIn Multiply(), received A:"<< x <<" and B:" << y << "\n";
return (x*y);
}
int Divide (int x, int y)
{
cout <<"\nIn Divide(), received A:"<< x <<" and B:" << y << "\n";
return (x/y);
}
int Subtract (int x, int y)
{
cout <<"\nIn Subtract(), received A:"<< x <<" and B:" << y<< "\n";
return (x-y);
}
int Modulus (int x, int y)
{
cout <<"\nIn Modulus(), received A:"<< x <<" and B:" << y<< "\n";
return (x%y);
}
int main()
{
cout << "I'm in main()\n";
int a, b, c, d, e, f, g;
cout << "enter two numbers:\n";
cin >> a;
cin >> b;
cout<<"\nCalling Add()\n";
c=Add (a,b);
cout <<"C was set to "<< c <<"\n";
cout <<"\nCalling Subtract()\n";
d=Subtract (a,b);
cout <<"D was set to "<< d <<"\n";
cout <<"\nCalling Multiply()\n";
e=Multiply (a,b);
cout <<"E was set to "<< e <<"\n";
cout <<"\nCalling Divide()\n";
f=Divide (a,b);
cout <<"F was set to "<< f <<"\n";
cout <<"\nCalling Modulus()\n";
g=Modulus (a,b);
cout <<"G was set to "<< g <<"\n";
cout <<"\nExiting....\n\n";
system("pause");
return 0;
}
/***********
I'm in main()
enter two numbers:
5
5
Calling Add()
In Add(), received A:5 and B:5
C was set to 10
Calling Subtract()
In Subtract(), received A:5 and B:5
D was set to 0
Calling Multiply()
In Multiply(), received A:5 and B:5
E was set to 25
Calling Divide()
In Divide(), received A:5 and B:5
F was set to 1
Calling Modulus()
In Modulus(), received A:5 and B:5
G was set to 0
Exiting....
Press any key to continue . . .
*********/
1/30/08
initials
#include
using namespace std;
int main()
{
cout<<"jjjjjjjjjjjjjjjjjjjjjjj mmmmmm mmmmmm sssssss\n";
cout<<"jjjjjjjjjjjjjjjjjjjjjjj mmmmmmmm mmmmmmmm ssssssssssss\n";
cout<<" jjjj mmmmmmmmmm mmmmmmmmmm ssss sssss\n";
cout<<" jjjj mmmmmmmmmmm mmmmmmmmmmm ssss sssss\n";
cout<<" jjjj mmmmmmmmmmmmmmmmmmmmmmm ssssss\n";
cout<<" jjjj mmmmmmm mmm mmmmmmm sssss\n";
cout<<" jjjj mmmmmmm m mmmmmmm sssss\n";
cout<<"jjj jjjj mmmmmmm mmmmmmm ssss sssss\n";
cout<<" jjj jjjjj mmmmmmm mmmmmmm sssss sssss\n";
cout<<" jjjjjj mmmmmmm mmmmmmm ssssssss\n";
system ("pause");
}
1/28/08
Hello World
#include //this includes a whole program so you don't have to type it
using namespace std;
int main() //this is a function called main()
{ //this is a brace, it opens main()
cout<<"Hello World!\n"; //This prints Hello World! on the screen
system("Pause"); //This has the program wait for you before ending
} //this ends main
/*********
Hello World!
Press any key to continue . . .
*********/
Comments (0)
You don't have permission to comment on this page.