更多"______是指从单击位置开始并随着字符输入而扩展的一行或一列横排或直"的相关试题:
[填空题]以下程序的功能是:对输入的一行字符串的数字字符按它们的字面值累加,输出此累加和。例如,输入一行字符是:ab34dh8u,输出值应当是15。请填空。
#include <stdio.h>
#include <ctype.h>
main( )
char ch; int a,s;
______;
while((ch=getchar( ))______)
if( isdigit (ch))
a=______;s+=a;
printf("s=%d/n/n",s);
[填空题]以下程序的功能是从键盘上输入一行字符,存入一个字符数组中,然后输出该字符串。请填空。
main( )
char str[81],*sptr;
int i;
for(i=0;i<80;i++)
str[i]=getchar( );
if(str[i]==’/n’)break;
str[i]= 【10】 ;
sptr=str1
while(* sptr)putchar(* sptr 【11】 );
[填空题]
以下程序的功能是;从键盘输入一行字符串,将输入字符串中连续的数字作为一个整数,整数前的"+"和"_"分别表示正整数和负整数。依次取出相关的连续数字字符,并转换为整数后存放到整型数组中。函数change_int( )实现从字符串中依次取出整数并放入数组中
例如;输入字符串:"sf-123 abc+456 df7890j",则输出-123 456 7890
[程序](4分)
#include
void change_int(())
{
int flag;
count=0;
while(*p){
flag=1; //flag=1为正整数,flag=-1为负整数
while((*p<’0’||*p>’9’)&& ())p++;
if(*p==’-’){
flag=-1;
p++;
}
else if(*p==’+’) p++;
if(*p>=’0’ && *p<=’9’){
int num=0;
while(()){
num=num*10+*p-’0’;
p++;
}
num= () ;
b[count]=num;
count++;
}
}
}
void main(void)
{
char str[400];
int a[20],n;
cout<<"请输入一个含有数字的字符串;/n";
cin.getline(str,400);
change_int(str,a,n); ,
cout<<"输入字符串中共有"<个整数,它们分别是;/n";
[填空题]下列程序的功能是对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。
#include<stdio.h>
#include<ctype.h>
main( )
char c;
int a,s=0;
while(______)
if(isdigit(c))
a= c-’0’;s+=a;
printf("s=%d",s);
[填空题]下列程序的功能:对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。
#include<stdio.h>
#include<ctype.h>
main( )
{ char c;
int a,s=0;
while(______)
if(isdigit(c))
{a=c-’0’;s+=a;}
printf("s=%d",s);
}
[填空题]以下程序的功能是:对输入的一行字符中的数字字符的字面值累加,输出此累加和,
请填空。
#include<stdio.h>
#include<ctype.h>
main( )
{char c;
int a,s=0;
while(______)
if(isdigit(c))
{a=c-’0’;s+=a;}
printf("S=%d",s);
}
[填空题]下列程序的功能是对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。
# include<stdio.h>
# include<ctype.h>
main( )
char c;
mt a,s=0;
while(______)
if(isdigit(c))
a=s-’0’;s+=a;
printf("s=%d",s);
[填空题]下列程序的功能是对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。
#include<stdio.h>
#include<ctype.h>
main( )
char c;
int a,s=0;
while(______)
if(isdigit(C) )
a=c-’0’;s+=a;
printf("s=%d",s);
[填空题]下列程序的功能:对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。
#include<stdio.h>
#include<ctype.h>
main( )
char c;
int a,s=0;
while(______)
if(isdigit(c))
a=c-’0’;s+=a;
printf("s=%d",s);
[填空题]下列程序的功能是对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。
#include<stdio.h>
#include<ctype.h>
main( )
{ char c;
int a,s=0;
while(______)
if(isdigit(c))
{a= c-’0’;s+=a;}
printf("s=%d",s);
}
[判断题]文档输入满一行时,应按Enter键开始下一行。( )