Initial commit
This commit is contained in:
20
cpp/Основы/ввод.cpp
Normal file
20
cpp/Основы/ввод.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
/* Ввод
|
||||
Синтаксис: устройство >> переменная
|
||||
cin - console input - консоль как устройство ввода
|
||||
>> оператор ввода
|
||||
*/
|
||||
float num;
|
||||
cout << "Введи число: "; // *Отсутствует endl
|
||||
cin >> num;
|
||||
cout << "Число в квадрате: " << num * num << endl;
|
||||
|
||||
printf("Введи число: ");
|
||||
scanf("%f", &num); // Ввод в стиле C
|
||||
printf("Число, умноженное на 5: %f\n", num * 5);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user