枚举类型关键字 enum herotype{
tank,0
adc,1
assidt 2
};
int main(){
heroType heroType=tank;
hero
}
枚举类型关键字 enum herotype{
tank,0
adc,1
assidt 2
};
int main(){
heroType heroType=tank;
hero
}
#include <string>;
#include <iostream>;
#include d"stdafx.h";
using namesoace std;
int main()
{
stringr str1="nihao";
string str2="hello";
getline(cin,str1);
cout<<str1;
returrn 0;
string s=str1+str2;
s+=str1;
cout<<s<<endl;
cout<<s.size()<<
}
int see[20]={12,545,66,6};
声明和初始化是一起的
#include "stdafx.h"
#include <iostream>
int main(){
float a=3;
int b=3.3;
int c=3e20;
float f-=344.23;
int c=(int)23.5;
int d=int(23.5);
int e=int(f);
return 0;
}
#include "stdafx.h"
#include <iostream>
int main(){
float a;
cout<<"请输入一个数字"<<endl;
cin>>a;
cout<<a;
cout<<
return 0;
}
#include ''stdafx.h'
#include <iostream>
using namespace std;
int main()
{
+3.4E9
int t;
cin>>t;
float a=12.2;
double b=23.4;
long double c=231.3;
cout<<a;
return 0;
}
第三题:
// 19-编程练习3.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <array>
using namespace std;
int main()
{
array <float, 4> s = {};
cout << "请输入你的第一次成绩:";
cout << endl;
cin >> s[0];
cout << "请输入你的第二次成绩:";
cout << endl;
cin >> s[1];
cout << "请输入你的第三次成绩:";
cout << endl;
cin >> s[2];
s[3] = (s[0] + s[1] + s[2]) / 3;
cout << "你的平均成绩是:" << s[3] << endl;
return 0;
}
// 04-字符类型.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout << "字母大小写转换程序" << endl;
cout << endl;
cout << "请输入字母:";
char a;
char c;
cin >> a;
cout << endl;
if (a>=65 && a<=90)
{
a = a + 32;
cout <<"字母转换结果为:"<< a << endl;
}
else if (a >= 97 && a <= 122)
{
a = a - 32;
cout << "字母转换结果为:"<< a << endl;
}
cout << endl;
return 0;
}
老师居然说了c#
cin.getline(name.30)
main()函数是程序的入口
动态链接库不需要main()函数作为入口
注释快捷键:
加注释:ctrl + k ctrl + c
去注释:ctrl + k ctrl + u
方法
delete p;
delete[]p;