#include <iostream>
#include <clocale>
using namespace std;
int main()
{
setlocale(LC_ALL,"Russian");
int s;
cout << "Введите s: ";
cin >> s;
switch(s)
{
case 0: cout << "LOSE"; break;
case 1: cout << "DRAW"; break;
case 3: cout << "WIN"; break;
default: cout << "Неверное число."; break;
}
}
Объяснение:
#include <iostream> // Библиотека ввода-вывода
#include <clocale> // Библиотека локализации (возможно, будет работать без нее)
using namespace std; // Пространство имён
int main()
{
setlocale(LC_ALL,"Russian"); // Локализация (возможно, будет работать без нее)
int s; // Создание целочисленной переменной
cout << "Введите s: "; // Вывод текста в консоль
cin >> s; // Ввод переменной с клавиатуры
switch(s) // Принимает значение s
{
case 0: cout << "LOSE"; break; // Если s = 0, то выводим LOSE
case 1: cout << "DRAW"; break; // Если s = 1, то выводим DRAW
case 3: cout << "WIN"; break; // Если s = 3, то выводим WIN
default: cout << "Неверное число."; break; // Если s не равно ни одному из трёх чисел, то выводим Неверное число
}
}
#include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
if (a > 0)
{
a += 1;
}
cout << a;
}
Объяснение:
#include <iostream> // Библиотека ввода - вывода
using namespace std; // Пространство имен
int main()
{
int a; // Создание целочисленной переменной a
cin >> a; // Ввод значения переменной a с клавиатуры
if (a > 0) // Если значение переменной а > 0
{
a += 1; // К переменной a прибавляем единицу
}
cout << a; // Выводим значение переменной a
}
<!doctype html><html><head></head><body><!-- меньше алертов --><script type="text/javascript">function stroka(x,y,z) { var str = prompt("BBegu"); var sumx; var sumy; var sumz; var x; var y; var z; sumx=0; sumy=0; sumz=0; if (str.indexOf("*") >= 0) { x = str.indexOf("*"); document.write("str[x"+x+"]="+str[x]+"<br>"); sumx=sumx+1; } else { document.write("HeTy x <br>"); } if (str.indexOf(":") >= 0) { y = str.indexOf(":"); document.write("str[y"+y+"]="+str[y]+"<br>"); sumy=sumy+1; } else { document.write("HeTy y <br>"); } if (str.indexOf(";") >= 0) { z = str.indexOf(";"); document.write("str[z"+z+"]="+str[z]+"<br>"); sumz=sumz+1; } else { document.write("HeTy z <br>"); }
for (i=0; i<=str.length-1; i++) { if (str.indexOf("*",i) > x) { document.write("str["+str.indexOf("*",i)+"]="+str[str.indexOf("*",i)]+"<br>"); sumx=sumx+1; x = str.indexOf("*",i); } if (str.indexOf("*",i) > y) { document.write("str["+str.indexOf(":",i)+"]="+str[str.indexOf(":",i)]+"<br>"); sumy=sumy+1; y = str.indexOf(":",i); } if (str.indexOf("*",i) > z) { document.write("str["+str.indexOf(";",i)+"]="+str[str.indexOf(";",i)]+"<br>"); sumz=sumz+1; z = str.indexOf(";",i); } } document.write('sumx='+sumx+"<br>"); document.write('sumy='+sumy+"<br>"); document.write('sumz='+sumz+"<br>");}stroka (2);alert(x);
</script><br /></body></html>