基础课件2.8数据的输入8.pptxVIP

  • 5
  • 0
  • 约2.18千字
  • 约 8页
  • 2022-05-25 发布于北京
  • 举报
本节主题: 数据的输入 用scanf函数输入  scanf函数的功能:从标准输入(一般是键盘)获得数据  格式控制符  %d,%i:用来输入整型(int)数据,长整型ld,短整型hd  %o:用来输入八进制整数,%lo, %ho……  %x:用来输入十六进制整数,lx,hx……  %u: 用来输入无符号十进制数,lu……  %c:用来输入单个字符。  %f:用来输入浮点数,用小数形式或指数形式输入 scanf(格式描述串, 变量地址); #include stdio.h int a, b; scanf(%d %d,a,b); printf(%d\n,a+b); 输入数据的分割 int a, b; scanf(%d %d,a,b); scanf(%d%d,a,b); printf(%d\n,a+b); scanf(%d,%d,a,b); printf(%d\n,a+b); scanf(%dand%d,a,b); printf(%d\n,a+b); scanf(a=%d,b=%d,c=%d,a,b,c); 2 3 5 2 3 5 2 3 5 2,3 5 2 3 33 2and3 5 2,3 33 2和3中间输 入Tab键 不希望出 现的结果 不希望出 现的结果 如何处置? 不同类型数据的自然分割 #include stdio.h int main() {

文档评论(0)

1亿VIP精品文档

相关文档