Add Initial commit
This commit is contained in:
BIN
CM2005 Object Oriented Programming/Topic 1/1.7.1/a.exe
Normal file
BIN
CM2005 Object Oriented Programming/Topic 1/1.7.1/a.exe
Normal file
Binary file not shown.
26
CM2005 Object Oriented Programming/Topic 1/1.7.1/main.cpp
Normal file
26
CM2005 Object Oriented Programming/Topic 1/1.7.1/main.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int difference(int a, int b);
|
||||||
|
|
||||||
|
void printHello()
|
||||||
|
{
|
||||||
|
std::cout << "Hello" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** compute the average of x and y**/
|
||||||
|
float average(float x, float y)
|
||||||
|
{
|
||||||
|
float sum;
|
||||||
|
sum = x+y;
|
||||||
|
return (x+y)/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printHello();
|
||||||
|
float a = average(15, 23);
|
||||||
|
std::cout << a << std::endl;
|
||||||
|
int c = difference(10, 7);
|
||||||
|
std::cout << c << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int difference(int a, int b)
|
||||||
|
{
|
||||||
|
return a-b;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user