-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelementary.cpp
More file actions
64 lines (52 loc) · 813 Bytes
/
elementary.cpp
File metadata and controls
64 lines (52 loc) · 813 Bytes
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
#include <iostream>
using namespace std;
//global vars
int d = 50;
void welcome()
{
cout << "Welcome Ammar \n";
}
void printNumber(int numtoprint)
{
cout << numtoprint << endl;
}
int add(int a, int b)
{
return a + b;
}
char getYesNo();
int main()
{
int a(15);
int b = 15;
/*{
c = 3; local variable
}*/
welcome();
printNumber(b);
printNumber(add(3, 4.2));
cout << " returns integer! \n";
cout << "user input " << getYesNo() << endl;
{
d = 501; //modified this global variable
}
cout << d << endl;
if (b > a)
{
cout << "a is less than b" << endl;
}
else if (b == a) {
cout << "a equals b" << endl;
}
else
{
cout << "a is not equal to b" << endl;
}
}
char getYesNo()
{
cout << " Please enter a y or n \n";
char response;
cin >> response;
return response;
}