- 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 и др.
Site bomb , but friends, translate the tasks into your native language because it is not very clear what it is about
What is the native language ?
Machine
Hello
#include
using namespace std;
class Date {
public:
int day, month, year;
Date () {}
Date(int day, int month, int year) {
this->day = day;
this->month = month;
this->year = year;
}
string toString() {
string d = “”, m = “”;
if (day < 10) d = "0";
if (month car_model = car_model;
this->manufacturer = manufacturer;
this->class1 = class1;
this->year = year;
this->date = date;
}
Print() {
cout << "\t" << car_model << "\t" << manufacturer << "\t" << class1 << "\t" << year << "\t" << date.toString() << endl;
}
};
int main() {
Car* Cars[] {
new Car("AE86 Sprinter Trueno", "Toyota", "\tSport car", 2001, Date(01, 01, 2006)),
new Car("Skyline X\t", "Nissan\t", "Sport car", 2003, Date(12, 04, 2005)),
new Car("Corvette C3 Cabriolet", "Chevrolet", "Sport car", 2000, Date(17, 05, 2002)),
new Car("Ferrari F40\t", "Ferrari\t", "Sport car", 1969, Date(01, 06, 2017)),
new Car("Celica\t\t", "Toyota", "\tSport car", 1999, Date(03, 03, 2004))
};
for (int i = 0; i manufacturer == “Toyota” && Cars[i]->date.year Print();
}
return 0;
}
Clear
Create an application to evaluate the user's arithmetic expression. The user enters some arithmetic expression from the keyboard. An expression can contain: (), +, -, *, /.
The application calculates the result of the expression, taking into account the parentheses, priorities. The result is displayed on the screen. Example, if the user entered:
5*2 + 1
Result: 11
If the user entered:
5 * (2+1)
Help pls, urgently needed, only without extra libraries and so on!!!!!!
Create an Application to Evaluate a User Arithmetic Expression. The user enters some arithmetic expression from the keyboard. The expression may contain: (), +, -, *, /.
The application evaluates the result of the expression, taking into account the brackets, priorities. The result is displayed on the screen. For example, if the user entered:
5*2 + 1
Result: 11
If the user entered:
5* (2+1)
Please write C++ code to solve this equation.: (3x+1/2-6.5x=3.1/2+10x/11)
Help, you are welcome!!! Very urgent!!!
A task – Generate a new line, which includes words in ascending order of length. Find the first digital word and change its value, I divided into 100.
Using the library
Here is the answer
#include
#include
#include
#include
#include
#include
int main() {
SetConsoleOutputCP(1251);
SetConsoleCP(1251);
// Enter a string
std::string inputString;
std::cout << "Введите строку: ";
std::getline(std::cin, inputString);
// Splitting a string into words
std::istringstream iss(inputString);
std::string word;
std::vector words;
while (iss >> word) {
words.push_back(word);
}
// Sort words by length
std::sort(words.begin(), words.end(), [](const std::string& a, const std::string& b) {
return a.length() < b.length();
});
// Finding the first digital word and changing its meaning
for (auto& w : words) {
if (std::all_of(w.begin(), w.end(), ::isdigit)) {
int numericValue = std::standing(w);
numericValue /= 100;
w = std::to_string(numericValue);
break;
}
}
// Formation of a new line
std::string resultString;
for (const auto& w : words) {
resultString += w + " ";
}
// Output of the result
std::cout << "Новая строка: " << resultString << std::endl;
return 0;
}
these are libraries
don't forget to close the parentheses
#include < iostream
#include < string
#include < algorithm
#include < sstream
#include < vector
#include < windows.h
Help with a C++ task
If all units are located before the maximum element of the table, then replace the maximum table element with the number of these units