int inch;
bool answer=true;
from these, you can construct:
// simple function that asks user to proceed
bool accept() {
cout << “Do you want to proceed (yN)?\n”;
char answer=0;
cin >> answer;
if (answer == ‘y’) return true;
return false;
}
// more complex function, with a switch statement
bool accept2() {
cout << “Do you want to proceed (yN)?\n”;
char answer=0;
cin >> answer;
switch (answer) {
case ‘y’:
return true;
case ’n’:
return false;
default:
cout << “Whatever, it’s a no.\n”;
return false;
}
}
while (condition) {
// execute code
// opt. increment iterator
}
for (int i=0; i<10; i++) {
// execute code
}
char v[10]; // array of 10 chars, with 0 as lower bound
char* p; // pointer to a char element
p = &v[3]; // p points to address of index 3 of array v