The 8859-1 character code for the uppercase letter A is 65. Which of these code fragments declare and initialize a variable of type char with this value?()
第1题:
下列程序的功能是:求出ss所指字符串中指定字符的个数,并返回此值。
例如,若输入字符串123412132,输入字符1,则输出3,请填空。
#include
#include
#define M 81
int fun(char *ss, char c)
{ int i=0;
for(; ( );ss++)
if(*ss==c)i++;
return i;}
main()
{ char a[M], ch;
clrscr();
printf("\nPlease enter a string: "); gets(a);
printf("\nPlease enter a char: "); ch=getchar();
printf("\nThe number of the char is: %d\n", fun(a,ch));}
第2题:
在执行以下程序时,如果从键盘上输入ABCdef<回车>,则输出为______。#include <stdio.h>main (){ char ch; while ((ch=getchar())!="\n") { if (ch>='A'&& ch<='B')ch=ch+32; else if (ch>='a'&& ch<='z')ch=ch-32; printf("%c",ch); } printf("\n");}
A.ABCdef
B.abcDEF
C.abc
D.DEF
第3题:
下列程序的功能是:求出ss字符串中指定字符c的个数,并返回此值。请编写函数int num(*char ss,char c)以实现程序要求,最后调用函数readwriteDat(),把结果输出到文件out.dat中(注:大小写字母有区别)。例如:若输入字符串“ss="123412132" , c=’1’”,则输出“3”。部分源程序已给出。请勿改动主函数main()和输出数据函数writeDat()的内容。#include <conio.h>#include <stdio.h>#define M 81void readwriteDAT(); int num(char *ss,char c){ } main(){ char a[M],ch; clrscr(); printf("\nPlease enter a string:" );gets(a); printf("\nPlease enter a char;" );ch=getchar(); printf("\nThe number of the char is:%d\n" ,num(a,ch)); readwriteDAT();}viod readwriteDAT(){ int i; FILE *rf,*wf; char a[M],b[M],ch; rf=fopen("in.dat" ,"r" ); wf=fopen(" out.dat" ,"w" ); for(i=0;i<10;i++){ fscanf(rf," %s",a); fscanf(rf," %s" ,b); ch=*b; fprintf(wf," %c=%d\n:" ,ch,num(a,ch));} fclose(rf); fclose(wf);}
第4题:
下列程序的输出结果是【 】。
include<iostream>
include<cstring>
using namespace std;
void fun(const char *s,char &c){c=s[strlen(s)/2];}
int main()
{
char str[]="ABCDE";
char ch=str[1];
fun(str,ch);
cout<<ch;
return 0;
}
第5题:
下列程序段中,不能正确赋值的是
A.char*p,ch; p=&ch; scanf("%c,&p")
B.char*p; p=(char*)malloc(1); scanf("%c",p);
C.char*p; *p=getchar();
D.char*p,ch; p=缸h; *p=getchar();
第6题:
以下程序的输出结果是______。 char cchar(char ch) { if(ch>='A'&&ch<='z')ch=ch-'A'+'a'; return ch; } main() { char s[]="ABC+abc=defDEF",*p=s; while(* p) { * p=cchar(* p); p++; } printf("% s\n", s); }
A.abe+ABC=DEFdef
B.abc+abe=defdef
C.abcaABCDEFdef
D.abcabcdefdef
第7题:
关于类定义中的语句错误的是 class A { iht i; A a; A * b; char * ch;};
A.int i;
B.A a;
C.A * b;
D.char * ch;
第8题:
下列对结构及其变量定义错误的是( )。
A.struct My Struct { int num; char ch; }
B.struct MyStruct { int num; char ch; }My;
C.strut { int num; char ch; }My;
D.struct { int num; char ch; };
第9题:
在Java语言中定义了如下变量:char ch;下列赋值语句正确的是()。
第10题:
已知’A’一’Z’的ASCII码为65—90,当执行"char ch=14*5+2;cout<
第11题:
Which two are valid declarations of char?()
第12题:
Char ch = “a”;
Char ch = ‘/’ ‘;
Char ch = ‘cafe’;
Char ch = “cafe”;
Char ch = ‘/ucafe’;
Char ch = ‘/u10100’;
Char ch = (char) true;
第13题:
下列字符数组的初始化,正确的是( )。
A.char ch[5]={"a","b","c","d","e"};
B.char ch[]={'a','b'};
C.char ch[15]={"welcome to china"};
D.char ch[14]={"I am a student"};
第14题:
A.
B. a
C. Z
D. z
第15题:
下列对结构及其变量定义错误的是( )。
A.struct My Struct
B.struct MyStruct{ {int num; int num;char ch; char ch;} }My;
C.strut
D.struct{ {int num; int num;char ch; char ch;}My; };
第16题:
下列程序运行时,若输入labcedf2df<回车>输出结果为【 】。
include<stdio.h>
main()
{ char a=0,ch;
while((ch==getchar())!='\n')
{ if(a%2!=0&&(ch>='a'&&ch<='z')) ch=ch'a'+'A';
a++;prtchar(ch);
}
printf("\n");
}
第17题:
下面程序中,若从键盘输入大写字母C,则程序的输出结果是______。 import java.io.*; public class Test{ public static void main(String args[ ]){ int ch=0; System.out.println("Please input a character:"); try{ ch=System.in.read( ); char ch_A='A',ch_Z='Z'; int delta_c=(int)ch_A+(int)ch_Z-ch; System.Out.println("the encoded character is:"+(char)delta_C); }catch(IOException e){e.printStackTrace( );} } }
A.C
B.Y
C.X
D.字母C的ASCII码的整型值
第18题:
若有char ch[10],则下列字符串数组的赋值中不正确的是( )。
A.ch="welcome";
B.ch[0]='w';
C.strcpy(ch,"welcome");
D.char ch1[]="welcome";strcpy(ch,ch1);
第19题:
在执行以下程序时,如果从键盘上输入:ABCdef<回车>,则输出为______。 main() { char ch; while((ch=getchar())!='\n') { if(ch>='A' && ch<='Z') ch=ch+32; else if(ch>='a'&&ch<='2')ch=ch-32; printf("%c",ch); } printf("\n"); }
A.ABCdef
B.abcDEF
C.abc
D.DEF
第20题:
以下程序的输出结果是 char cchar(char ch) { if(ch>='A'&&ch<='Z') ch=ch-'A'+'a'; return ch; } main ( ) { char s [] = "ABC+abc=defDEF" , *p=s; while (*p) { *p=cchar(*p); p++; } printf { "%$\n", s); }
A.abc+ABC=DEFdef
B.abc+abc=defdef
C.abcABCDEFdef
D.abcabcdefdef
第21题:
下列选项中,能有效声明一个字符的语句有()。
第22题:
判断char型变量ch是否为小写字母的正确表达式是()
第23题:
char ch = 65;
char ch = ’¥65’;
char ch = ’¥0041’;
char ch = ’A’;
char ch = A;