
Вопрос задан 16.02.2019 в 21:11.
Предмет Информатика.
Спрашивает Гайдин Дима.
Написать тест на языке программирования С++: Пример: 2+2=4? Да - верно Нет - не верно 2 вопроса.


Ответы на вопрос

Отвечает Мырзахмет Жанет.
Int main ...
int a,b,c;
cout <<" 2+2=4? 1-да, 2 - нет " << endl;
cin>>a;
if (a == 1) { cout <<" Верно " << endl;}
if (a==2) { cout <<" Ошибка " << endl;}
cout <<" 3+2=5? 1-да, 2 - нет " << endl;
cin>>a;
if (a == 1) { cout <<" Верно " << endl;}
if (a==2) { cout <<" Ошибка " << endl;}
system ("pause");
return 0;
int a,b,c;
cout <<" 2+2=4? 1-да, 2 - нет " << endl;
cin>>a;
if (a == 1) { cout <<" Верно " << endl;}
if (a==2) { cout <<" Ошибка " << endl;}
cout <<" 3+2=5? 1-да, 2 - нет " << endl;
cin>>a;
if (a == 1) { cout <<" Верно " << endl;}
if (a==2) { cout <<" Ошибка " << endl;}
system ("pause");
return 0;



Отвечает Дунаев Данил.
#include <iostream>
#include <string>
#include <conio.h>
#include <Windows.h>
using namespace std;
void main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
char answer[3];
setlocale(0, "");
cout << "2+2=4 ?" << endl;
cin >> answer;
if ((answer[0] == 'Д') && (answer[1] == 'а'))
cout << "Верно" << endl;
else cout << "Не верно" << endl;
cout << "5+5=10 ?" << endl;
cin >> answer;
if ((answer[0] == 'Д') && (answer[1] == 'а'))
cout << "Верно" << endl;
else cout << "Не верно" << endl;
_getch();
}
P.S в свойства консоли надо поменять шрифт на "Consolas"
#include <string>
#include <conio.h>
#include <Windows.h>
using namespace std;
void main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
char answer[3];
setlocale(0, "");
cout << "2+2=4 ?" << endl;
cin >> answer;
if ((answer[0] == 'Д') && (answer[1] == 'а'))
cout << "Верно" << endl;
else cout << "Не верно" << endl;
cout << "5+5=10 ?" << endl;
cin >> answer;
if ((answer[0] == 'Д') && (answer[1] == 'а'))
cout << "Верно" << endl;
else cout << "Не верно" << endl;
_getch();
}
P.S в свойства консоли надо поменять шрифт на "Consolas"



Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.
Writing a C++ Programming Test
To create a simple C++ programming test, we can use basic arithmetic questions as examples. Here are two questions for the test:
1. Question 1: What is the result of 5 + 3? - A) 8 - B) 7
2. Question 2: What is the output of the following code snippet? ```cpp int x = 10; int y = 5; int result = x - y; std::cout << "The result is: " << result; ``` - A) The result is: 5 - B) The result is: 15
These questions cover basic arithmetic operations and output interpretation in C++.
Let me know if you need further assistance with C++ programming or creating more complex test questions!


Топ вопросов за вчера в категории Информатика
Последние заданные вопросы в категории Информатика
Предметы
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili