Openjudge 1.1 输入输出

1.1.3

按每个整数占8个字符的宽度

#include <cstdio>
using namespace std;
int main( ){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	printf("%8d %8d %8d",a,b,c);//%8d
	return 0;
}

知识点:%8d

http://noi.openjudge.cn/ch0101/03/

1.1.4

读入一个单精度浮点数,保留3位小数输出这个浮点数。

#include <cstdio>
using namespace std;
int main( ){
	float a;//(int)
	scanf("%f",&a);
	printf("%.3f",a);
	return 0;
}

http://noi.openjudge.cn/ch0101/04/

1.1.5

双精度浮点数

#include <cstdio>
using namespace std;
int main( ){
	double a;
	scanf("%lf",&a);
	printf("%.12lf",a);
	return 0;
}

http://noi.openjudge.cn/ch0101/05/

1.1.6

字符型 一个字符 标记符是%c 字符串是%s

#include <cstdio>
using namespace std;
int main( ){
	char s;
	int x;
	float y;
	double z;
	scanf("%c%d%f%lf",&s,&x,&y,&z);
	printf("%c %d %.6f %.6lf",s,x,y,z);
	return 0;
}

http://noi.openjudge.cn/ch0101/06/

1.1.7

换行符

include <cstdio>
using namespace std;
int main( ){
	double m;
	scanf("%lf",&m);
	printf( "%f
",m);
	printf( "%.5f
",m);
	printf( "%e
",m);
	printf( "%g
",m);
	return 0;
}

http://noi.openjudge.cn/ch0101/07/

要做就做南波万
原文地址:https://www.cnblogs.com/liuziwen0224/p/11991597.html