Openjudge 1.2 变量定义、赋值并转换
1.2.1
字节大小使用sizeof()
1.2.4
有两个变量a和b,在执行了如下代码后:
a = 32768;
b = a;
printf("%d %d\n", a, b);
输出两个数:32768 -32768
请问a和b分别是以下哪种类型?
A. bool B. char C. short D. int E. float F. double
(D C)
1.2.6
输入一个单精度浮点数,将其向零舍入到整数。
说明:向零舍入的含义是,正数向下舍入,负数向上舍入。
提示:可以使用强制类型转换来实现。
#include <cstdio>
#include <iostream>
using namespace std;
int main( ){
	float a;
	scanf("%f",&a);
	printf("%d",int(a));
	return 0;
}
http://noi.openjudge.cn/ch0102/06/
1.2.7
打印ASCII码 ‘a’?
#include <cstdio>
#include <iostream>
using namespace std;
int main( ){
	char s;
	scanf("%c",&s);
	printf("%d\n",s);
	return 0;
}
http://noi.openjudge.cn/ch0102/07/
1.2.8
ASCII码对应字符(%d &h推出%c h)
#include <cstdio>
#include <iostream>
using namespace std;
int main( ){
	char s;
	int h;
	//scanf("%c",&s);
	scanf("%d",&h);
	printf("%c",h/*'66'*/);
	return 0;
}
http://noi.openjudge.cn/ch0102/08/
include <bits/stdc++.h>
    要做就做南波万

 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号