- Data types, variables and constants
- Ввод с клавиатуры и вывод данных на экран
- Арифметические операции и комбинированные операторы
- Операторы выбора if и else в С
- The switch statement in C ++
- The for loop in C++
- Циклы while, do while, nested loops
- Two-dimensional arrays C ++
- Arrays in C++
- Functions in C++
- Pointers C ++
- A pointer to a pointer to C ++
- Classes in C ++
Additional collection of problems with solutions
This page contains all of the tasks on the topics lessons, posted on our website. К каждой задаче прилагается наш вариант решения. Постарайтесь всё же решать их самостоятельно и только потом сравнивать наш исходный код со своим. “Хочешь научиться программировать – программируй”!
Больше практических заданий с решениями найдёте here.
Рекомендуем посетить Сайт для юных программистов – где вы найдете уроки по различным языкам программирования (в том числе для детей), 3D-моделированию, Linux и др.
lovely Elephants
prb4715 In one Indian village teacher asked the boy Manmohan count the number of elephants in the village. Manmohan counted all the elephants in the village, and he got a two-digit number n. But instead of, to report the answer to the teacher, Manmohan has decided to play a trick bit. For this Manmohan subtracted from the resulting sum the number of its digits, I divide the result by 9 (rejecting at the same fractional part of the result), that number increased to 1, then append to the end of the last digit obtained starting from the result subtracted chislani 10. Then, what happened in the end, he told the teacher.
Despite all the cunning Manmohan, teacher could determine the number of resulting, how many elephants were in the village. Identify it and you.
Input data
Целое число, which received Manmohan.
Output
Print the number of elephants in the village.
Thank you, for homework. I worked the brain) The decision take off below:
// The solution of the problem
manhomannumb + = 10;
b = manhomannumb %10;
teachernumb = manhomannumb;
teachernumb /= 10;
teachernumb –;
teachernumb *= 9;
while (teachernumb % 10 != 0) teachernumb++;
teachernumb += b;
cout << "Учитель посчитал. Elephant Village: "<< teachernumb << endl;
system("pause");
return 0;
}
Thanks again)
Atvichayu there is an option much easier:
#include
int main(){ int n;
std::cin >> n;
std::cout << n;}
// Chapter Objectives 1. A task 1.36
// Space between numbers
#include “pch.h”
#include
using namespace std;
int main()
{
int tnum, drink, dec, one;
setlocale(LC_ALL, “Russian”);
cout <> tnum;
{
Dec = tnum / 10; //Break numbers into digits
Mnum = tnum % 10;
one = mnum / 1;
mnum = dec + one; //Manmohan subtracted the sum of its digits from the resulting number
Mnum = tnum – drink;
mnum = mnum / 9; //I divide the result by 9 (rejecting at the same fractional part of the result)
mnum = mnum + 1; //that number increased to 1
mnum = mnum * 10 + one; //added the last digit of the original number to the end of the received number
mnum = mnum – 10; //and subtracted from the result 10
cout << " Teacher elephants: " << tnum << " Manmohan number: " << drink << endl;
return 0;
}
}
//—————————————————————————
#include “pch.h”
#include
using namespace std;
int main()
{
int tnum, drink, dec, one;
setlocale(LC_ALL, “Russian”);
cout <> tnum;
{
Dec = tnum / 10; //Break numbers into digits
Mnum = tnum % 10;
one = mnum / 1;
mnum = dec + one; //Manmohan subtracted the sum of its digits from the resulting number
Mnum = tnum – drink;
mnum = mnum / 9; //I divide the result by 9 (rejecting at the same fractional part of the result)
mnum = mnum + 1; //that number increased to 1
mnum = mnum * 10 + one; //added the last digit of the original number to the end of the received number
mnum = mnum – 10; //and subtracted from the result 10
cout << " Teacher elephants: " << tnum << " Manmohan number: " << drink << endl;
return 0;
}
}
//—————————————————————————
I know how ispolzevat but I need examples please answer!
Learn to write, Guliza, and then for the mother let the computer.
help me please “Classes begin in n hours m minutes,and ends at a clock k hvydyn.Skilky hours and minutes long zahyattya
Move all in minutes, Vienna, and then find a result from Dillen – years, the balance – moments
I haven't studied C ++, decided something like this:
#include “pch.h”
#include
#include
using namespace std;
int main()
{
int n, m, k, a;
setlocale(LC_ALL, “Russian”);
cout << "Занятия начинаются в:" <> n;
if (n >= 24) {
cout << "ERROR1: CRITICAL VALUE: NO MORE THAN 24 HOURS IN A DAY!(from 0 to 23)" <> m;
}
if (m >= 60) {
cout << "ERROR2: CRITICAL VALUE: NO MORE THAN 60 MINUTES IN AN HOUR!(from 0 to 59)" << endl;
return 0;
}
else
{
cout << "Занятия заканчиваются в:" <> k;
if (k >= 24) {
cout << "ERROR1: CRITICAL VALUE: NO MORE THAN 24 HOURS IN A DAY!(from 0 to 23)" <> a;
}
if (a >= 60) {
cout << "ERROR2: CRITICAL VALUE: NO MORE THAN 60 MINUTES IN AN HOUR!(from 0 to 59)" << endl;
return 0;
}
else {
n = k – n;
m = a – m;
if (n < 0) {
cout << "ERROR3: ВНИМАНИЕ: CLASSES CANNOT LAST MORE DAYS!" << endl;
return 0;
}
else if (m < 0) {
n = n – 1;
m = abs(m);
}
{
cout << "Занятия закончатся через:" << n << ":" << m << endl;
return 0;
}
}
}
}
You can help very urgently needed “In the beauty salon come girls n. Each of them should visit the hairdresser and beautician. Everyone she spends hours on m. During that time the smallest k salon staff will serve all girls, If each employee can serve as a cosmetologist, and the hairdresser?”
Help please Proteins saryatali in the hollow N nuts. Every day they took half for yourself and your friends. If the number of nuts was odd that they put off a nut in the direction and the other half dilili,wherein the nut deferred again returned into the hollow. Write a program, podschitvayuschuyu,many nuts remain in the bag by K days?
#include
using namespace std;
int main()
{
int N, K;
cin >> N >> K;
for(K; K>0; K–){
if(N%2==1 and N!=1) N=(N/2)+1;
presence of N = N / 2;
}
cout << N;
}
help me please: write program code to solve the problem. The triangle vertex coordinates set A (0;0), At (and, and 1), Exist (-and, i + 1), and = 9. Calculate the height Ha of the inscribed circle and the radius r.
help me please: write program code to solve the problem. Triangle asked the coordinates of the vertices A (0;0), At (and, and 1), Exist (-and, and +1), and 9 =. Calculate the height Ha and inscribed circle radius r.
help me please: write program code to solve the problem. The triangle vertex coordinates set A (0;0), At (and, and 1), Exist (-and, i + 1), and = 9. Calculate the height Ha of the inscribed circle and the radius r.
Perform all tasks of a theoretical part and debug the reduced program
Perform all tasks of a theoretical part and debug the reduced program