C语言 · 字符串输入输出函数

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