float 浮点数
强制类型转换,自动类型转换
float 浮点数
强制类型转换,自动类型转换
运算符可以直接引用
乘除的结果类型与输入的数有关
float 浮点数
char 定义字符类型
字符 单引号获取定义 c=‘2a’
命名规范,变量名不可重复,下划线、字母开头
命名规则,类型 + 字符串
类型存在范围,不能超出范围
unsigned 使数据无符号,不能存在负数
return 返回值(类型)
visuai studio 2017
.visualstudio.com/
多行注释快捷键:ctrl+k松开后ctrl+c
取消注释:ctrl+k松开后ctrl+u
我自己写的感觉比老师的麻烦:
稍后再看
T T T T T F F T T T F
cin.get();
#inculude:引入
using:引入
#include"pch.h"
#include<iostream>
using namespace std;
int main()
{
cout<<"你好";
cout<<endl;
cout<<"你好我开始学程序了";
cout<<endl;
reutrn 0;
}
生疏
生疏
int a,b,c;
cout << "请输入第一个值:";
cin>>a;
cout << "请输入第二个值:";
cin>>b;
cout << "请输入第三个值:";
cin>>c;
if(a>b)
{
int temp = a;
a=b;
b=temp; // 酱油瓶和醋瓶交换
}
if(b>c)
{
int temp = b;
b=c;
c=temp;
}
cout<<a<<" "<<b<<" "<<c<<endl;
//结果:
请输入第一个值:40
请输入第二个值:20
请输入第三个值:3
20 3 40
int a,b,c;
cout << "请输入第一个值:";
cin>>a;
cout << "请输入第二个值:";
cin>>b;
cout << "请输入第三个值:";
cin>>c;
if(a>b)
{
int temp = a;
a=b;
b=temp; // 酱油瓶和醋瓶交换
}
if(b>c)
{
int temp = b;
b=c;
c=temp;
}
if(a>b)
{
int temp = a;
a=b;
b=temp; // 酱油瓶和醋瓶交换
}
cout<<a<<" "<<b<<" "<<c<<endl;
//结果:
请输入第一个值:50
请输入第二个值:20
请输入第三个值:10
10 20 50
// werdrew
// werrew
//werdsdfw
//wfdsdrew
// 10
// 0-9 //0-4 5-9
// 11 0-10 0-4
string str;
cin>>str;
bool isHui = true;
for(int i=0;i<str.size()/2;i++)
{
// i str.size()-1-i
if(str[i]==str[str.size()-1-i])
{
isHui=false;
}
}
if(isHui)
{
cout<<“是回文”<<endl;
}
else
{
cout<<"不是回文"<<endl;
}