Commit 7018f665 authored by Karine's avatar Karine

Exercis_05_13, Version1

parent 9daac871
exercise_05_13: main.o | .gitignore
g++ $^ -o $@
main.ii: main.cpp
g++ -E $^ -o $@
main.s: main.ii
g++ -S $^ -o $@
main.o: main.s
g++ -c $^ -o $@
.gitignore:
echo "exercise_05_13" > $@
clean:
rm *.ii *.s *.o *.out exercise_05_13 .gitignore
test: exercise_05_13
@./exercise_05_13 < test.in > test.out
@diff test.out test.expected > /dev/null 2>&1 && echo PASSED || echo FAILED
.PRECIOUS: main.ii main.s
.SECONDARY: main.ii main.s
#include <iostream>
int
main()
{
for (int i = 1; i <= 5; ++i) {
int number;
std::cout << "Enter the number (from 1 to 30): ";
std::cin >> number;
if (number < 1 || number > 30) {
std::cerr << "Error 1: Invalid number" << std::endl;
return 1;
}
for (int j = 1; j <= number; ++j) {
std::cout << "*";
}
std::cout << std::endl;
}
return 0;
}
Enter the number (from 1 to 30): **
Enter the number (from 1 to 30): *****
Enter the number (from 1 to 30): *************
Enter the number (from 1 to 30): ********
Enter the number (from 1 to 30): *************************
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