Есть ответ 👍

Написать тест на языке программирования с++: пример: 2+2=4? да - верно нет - не верно 2 вопроса.

128
228
Посмотреть ответы 3

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


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"
FSoxGy
4,5(38 оценок)

Сейчас ! подожди

Популярно: Информатика