Using pseudo code allows the user to focus on the problem.
This is presented in various locations. Page 92 of the book has the first presentation of this material.
This allows the representation of positive numbers with a much larger magnitude when the corresponding unsigned type.
By default all integer types are signed.
string ToUpper(string phrase);
string ToUpper(string phrase){ size_t i; for(i = 0; i < phrase.size(); i++) { phrase[i] = toupper(phrase[i]); } return phrase; }
enum WeekDayT {MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY};
struct MyDataT { string word; int count; };
MyDataT avar; avar.word = "hello"; avar.count = 1;
void FindExtreme(string fileName, int & max, int & min);
void FindExtreme(string fileName, int & max, int & min){ ifstream inFile; size_t i; int data; inFile.open("numbers.txt"); cin >> data; max = data; min = data; for(i = 1; i < 10; i++) { cin >> data; if (max < data) { max = data; } if (min > data) { min = data; } } inFile.close(); }
int count; int data; ifstream inFile; inFile.open("afile.txt"); while (inFile) { inFile >> data; count++; } cout << "There are " << count << " elements in the file" << endl;