算法提高 3-2字符串输入输出函数 时间限制:1.0s 内存限制:512.0MB 描述 编写函数GetReal和GetString,在main函数中分别调用这两个函数。在读入一个实数和一个字符串后,将读入的结果依次用printf输出。
两次输入前要输出的提示信息分别是"please input a number:\n”和"please input a string:\n" 样例输入 9.56
hello 样例输出 please input a number:
please input a string:
9.56
hello
1 #include<stdio.h> 2 void GetReal(double a){ 3printf("%.2f\n",a); 4 } 5 void GetString(char b[]){ 6printf("%s\n",b); 7 } 8 main(){ 9double a;10char b[100];11scanf("%lf",&a);12scanf("%s",&b);13printf("please input a number:\n");14printf("please input a string:\n");15GetReal(a);16GetString(b);17 }