Commit 6e347936 authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'branch4.20m' into 'master'

michael.davityan:exercise_04_20 See merge request bpcarm/trainings2017!1259
parents 077a4de1 bacecbd1
#include <iostream>
#include <unistd.h>
#include "Analysis.hpp"
void
Analysis::processExamResults()
{
int passes = 0;
int failures = 0;
int studentCounter = 1;
while (studentCounter <= 10) {
if (::isatty(STDIN_FILENO)) {
std::cout << "Enter result (1 = pass, 2 = fail): ";
}
int result;
std::cin >> result;
if (1 == result) {
++passes;
++studentCounter;
} else if (2 == result) {
++failures;
++studentCounter;
} else {
std::cout << "Info 1: wrong result, please insert 1 or 2: ";
}
}
std::cout << "Passed " << passes << "\nFailed " << failures << std::endl;
if (passes > 8) {
std::cout << "Raise tuition" << std::endl;
}
return;
}
class Analysis
{
public:
void processExamResults();
};
#include <iostream>
#include "Analysis.hpp"
int
main()
{
Analysis application;
application.processExamResults();
return 0;
}
Analysis: exercise_04_20.o Analysis.o .gitignore
g++ exercise_04_20.o Analysis.o -o Analysis
exercise_04_20.ii: exercise_04_20.cpp Analysis.hpp
g++ -E exercise_04_20.cpp -o exercise_04_20.ii
Analysis.ii: Analysis.cpp Analysis.hpp
g++ -E Analysis.cpp -o Analysis.ii
exercise_04_20.s: exercise_04_20.ii
g++ -S exercise_04_20.ii -o exercise_04_20.s
Analysis.s: Analysis.ii
g++ -S Analysis.ii -o Analysis.s
exercise_04_20.o: exercise_04_20.s
g++ -c exercise_04_20.s -o exercise_04_20.o
Analysis.o: Analysis.s
g++ -c Analysis.s -o Analysis.o
.gitignore:
echo Analysis > .gitignore
clean:
rm -f *.ii *.s *.o *.out Analysis .gitignore
test1: Analysis
./Analysis < test1.in > test1.out || echo "Test 1 is executing..."
diff test1.out test1.expected && echo PASSED || echo FAILED
test2: Analysis
./Analysis < test2.in > test2.out || echo "Test 2 is executing..."
diff test2.out test2.expected && echo PASSED || echo FAILED
test3: Analysis
./Analysis < test3.in > test3.out || echo "Test 3 is executing..."
diff test3.out test3.expected && echo PASSED || echo FAILED
.PRECIOUS: main.ii main.s
.SECONDARY: main.ii main.s
Info 1: wrong result, please insert 1 or 2: Info 1: wrong result, please insert 1 or 2: Info 1: wrong result, please insert 1 or 2: Info 1: wrong result, please insert 1 or 2: Passed 7
Failed 3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment