devc++抽风了,暂时用网页版编程。
目录
1.输入输出.scanf,printf
int:%d
#include <stdio.h>
//#include <iostream>
//using namespace std;//这两行,你确定用scanf输如输出,就不要写,dev会抽风
int main()
{
int a,b;
// cin>>a>>b;cout<<a+b;
scanf("%d%d",&a,&b);
printf("%d",a+b);
return 0;
}
long long:配套%lld
#include <stdio.h>
//#include <iostream>
//using namespace std;
int main()
{
long long int a,b;
// cin>>a>>b;cout<<a+b;
scanf("%lld%lld",&a,&b);
printf("%lld",a+b);
return 0;
}
更多配套
格式输入:只有%c会读入 空格
别的都是以空格为结束标志!
格式输出
printf("%2d",a)
%2d
%02d
%.2f
类似py
getchar和putchar
2.char是可以修改的
#include <stdio.h>
//#include <iostream>
//using namespace std;
int main()
{
char a='a';a='b';
return 0;
}
3.字符数组
长度!
#include <stdio.h>
//#include <iostream>
//using namespace std;
int main()
{
char a[3]="11";
char b[4]="@2";
char c[]="@2";
return 0;
}
4.bool
true--1
false--0
5.a++
a++:先使用a,再加
++a:先加1,在使用
5.逻辑运算
6.位运算
7.math
对象都是double a
头文件<math.h>
绝对值:fabs(a)
开根号:sqrt(a)
对数:log(a)
次方:x^y:pow(x,y)
上下取整:floor,ceil
(反)三角函数:
sin,cos,tan,asin……
四舍五入:round
3,3,4,4,4