输入不说明有多少个Input Block,但以某个特殊输入为结束标志。

 


1003 C语言输入以某个特殊输入为结束标志
 

C语法:
	while(scanf("%d",&n)  && n!=0 ) 
	{     .... } 

C++语法:
	while( cin >> n && n != 0 ) {     .... } 

 

#include <stdio.h>

int main(){
	int a,b;
	while(scanf("%d %d", &a, &b) && (a!=0 || b!=0)){
		printf("%d\n", a+b);
	}
}

 

 

 

 

相关文章:

  • 2021-11-28
  • 2021-12-23
  • 2021-10-15
  • 2022-12-23
  • 2021-06-27
  • 2021-11-30
  • 2021-11-21
  • 2021-11-25
猜你喜欢
  • 2022-12-23
  • 2021-06-22
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案