# Tasks: Select if and else statements in c ++

After reading the lesson about Select if and else statements, go to practice. As usual, I ask you to try to solve all tasks independently, and only then look at proposed us decision.

1. The first task is interesting and fairly simple. But the code will succeed long. This task came up with our teachers of computer Academy. The idea was to – how to get beginning students suffer with writing code, to scribbling was more ))) The task: The user enters the number of the 1 to 9999 (the amount of the issuance of an ATM). It should display the words entered by the amount and in the end to write the name of the currency with the correct ending. For example: 7431 – seven thousand four hundred thirty-one Dollars_, 2149 – two thousand one hundred forty-nine dollars_, 15 – fifteen dollars_, 3 – three dollars_. To solve this task you will need to use the operator % (remainder of the division). Read about it in an article, you can Arithmetic operations in C ++ . Start!

2. The user enters the serial number of the finger. It should show its name on the screen.

3. Another problem for yourself solutions. You must write a program, which checks the user on the knowledge of the multiplication table. The user enters two single-digit numbers. The program asks the question: the result of multiplying the first day of the second. The user must enter a response and see on the screen is correct or not, he said,. If not – show yet and the correct result.

To support our site – click on the piggy bank and choose any convenient way.

Tasks: Select if and else statements in c ++

## 172 thoughts on “Tasks: Select if and else statements in c ++”

1. Ilia says:

Сделал только для окончания =|
хочется поделиться своими начинаниями =D

#include
#include
using namespace std;

bool b(int x)
{
for(int i = 2; i <= 4; i )
{
if (x == i)
{
return true;
}
}
return false;
}

int main(int argc, char** argv)
{
setlocale(0,"");
int x;
do
{
cout <> x;
if ((x % 100) / 10 == 1)
{
cout << x << " Долларов\n";
}
else {
if ((x % 10) == 1)
{
cout << x << " Доллар\n";
}
else {
if (b(x % 10))
{
cout << x << " Доллара\n";
}
else
{
cout << x << " Долларов\n";
}
}
}
}
while(MessageBox(0,"Повторить?","",4) == IDYES);
return 0;
}

2. Ilia says:

cout – это std::cout
Вывод =|

1. Ilia says:

просто используют using namespace std и чтобы лучше понимать что это надо прочитать про пространство имен хотя я не читал еще :D