当前位置:编程学习 > C/C++ >>

麻烦高手帮忙做下C语言题目~~!!谢谢了

补充:题号:16 题型:是非题 本题分数:5 内容: 下面正确定义了仅包含一个数据成员info的单链表的结点类型。struct node { int info;struct node next;} 选项: 1、 错 2、 对 -------------------------------------------------------------------------------- 题号:17 题型:是非题 本题分数:5 内容: 赋值表达式x*=y-2等价于x=x*(y-2)。 选项: 1、 错 2、 对 -------------------------------------------------------------------------------- 题号:18 题型:是非题 本题分数:5 内容: 设:int x='g';则整型变量x被赋予字符g。 选项: 1、 错 2、 对 -------------------------------------------------------------------------------- 题号:19 题型:是非题 本题分数:5 内容: 设float x=15.6,y=3.2; 则表达式x % y错误。 选项: 1、 错 2、 对 -------------------------------------------------------------------------------- 题号:20 题型:是非题 本题分数:5 内容: 设:int a=511,*b=&a; 则printf("%d\n",*b);的输出结果为511。 选项: 1、 错 2、 对
答案:先给你救急。这两个题都不难。Good luck!

第二题答案送上:
#include "stdio.h"
#include "conio.h"  
main() 
{ 
int upper=0,lower=0,digit=0,other=0,i=0; 
char *p,s[80]; 
printf("\nInput a string:"); 
while ((s[i]=getchar())!='\n') i++; 
p=s; 
while(*p!='\n') 
{if((*p>='A')&&(*p<='Z')) 
upper++; 
else if((*p>='a')&&(*p<='z')) 
lower++; 
else if((*p>='0')&&(*p<='9')) 
digit++; 
else 
other++; 
p++; 
} 
printf("upper case:%2d lower case:%2d ",upper,lower); /*大写,小写*/
printf("digit:%2d other:%2d ",digit,other);/*数字,其他字符*/
getch(); 
} 

第一题

#include <stdio.h>
main(){
int i,temp;
int a[5]=;
temp=a[0];
for(i=0;i<4;i++)
{
  a[i]=a[i+1];
}
a[4]=temp;
for(i=0;i<5;i++)
printf("%d ", a[i]);
printf("\n");
}
其他:1 2  1 2 2 1.错。next应该为指针形式的。
2.对。考察运算符。
3.错,x仍然为整型。
4.错。%只对整型求余。
5.对。指针的使用。 1 1 1 2 2 

上一个:c语言中 fun 函数是怎么用的 ?
下一个:c语言初学者遇到的问题

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,