#include <iostream.h>
#include <fstream.h>
typedef int Bool;
const Bool TRUE = 1;
const Bool FALSE = 0;
char printableBool (Bool i) {
if (i==FALSE) {
return 'F';
}
else {
return 'T';
}
}
int main () {
ifstream f1, f2;
ofstream f3;
f1.open("exam");
f2.open("key");
f3.open("result");
int runningSum;
int ans, key, score;
runningSum = 0;
f1 >> ans;
f2 >> key;
while (f1) {
if (ans == key) {
runningSum = runningSum + 25;
score = TRUE;
}
else {
score = FALSE;
}
f3 << printableBool (score) << endl;
f1 >> ans;
f2 >> key;
}
f3 << endl << runningSum << endl;
}
Friday, 14 June 2013
Boolean expression second example using c++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment