Написать тест на языке программирования с++: пример: 2+2=4? да - верно нет - не верно 2 вопроса.
128
228
Ответы на вопрос:
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;
#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"
Популярно: Информатика
-
Arina2008egor03.03.2021 19:21
-
Кунілінгус22.02.2020 16:05
-
000конфета00023.06.2022 10:28
-
tkaa08.09.2021 11:00
-
ааааааа5923.02.2023 03:03
-
diana5566511.03.2022 01:22
-
123456789864216.10.2021 14:40
-
Lena8926929571720.01.2020 03:51
-
sofiapristensk14.10.2022 17:21
-
linakn1428.06.2021 20:31