A. c語言小寫字母student轉化為大寫字母
給這個小寫字母減去32,然後以字元輸出就好了,例如:
char a;
a=a-32;
print("%c",a);
這樣就可以輸入大寫字母A了
B. 在c語言中,student是關鍵字嗎
當然不是
C語言有32個關鍵字,分別是:
auto 局部變數(自動儲存)
break無條件退出程序最內層循環
case switch語句中選擇項
char單位元組整型數據
const定義不可更改的常量值
continue中斷本次循環,並轉向下一次循環
default switch語句中的默認選擇項
do 用於構成do.....while循環語句
double定義雙精度浮點型數據
else構成if.....else選擇程序結構
enum枚舉
extern在其它程序模塊中說明了全局變數
float定義單精度浮點型數據
for構成for循環語句
goto構成goto轉移結構
if構成if....else選擇結構
int基本整型數據
long長整型數據
registerCPU內部寄存的變數
return用於返回函數的返回值
short短整型數據
signed有符號數
sizoef計算表達式或數據類型的佔用位元組數
static定義靜態變數
struct定義結構類型數據
switch構成switch選擇結構
typedef重新定義數據類型
union聯合類型數據
unsigned定義無符號數據
void定義無類型數據
volatile該變數在程序中執行中可被隱含地改變
while用於構成do...while或while循環結構
C. c語言中「struct student」是什麼意思
聲明或生成struct
student
是個什麼類型!
比如:c語言中
struct
student
{…………}stu[n];
stu[n]是什麼意思?
意思就是:生成struct
student類型的stu數組,該數組元素有n個
D. c語言程序設計編程題目:請 :編寫完成對學生相關信息的要求:1.定義一個結構體類型student,其中包括三個成
#include <stdio.h>
#include <stdlib.h>
#define STU_NUM 10 /*宏定義學生的數量*/
struct student /*定義一個結構體用來存放學生學號、三門課成績、總分及平均成績*/
{
char stu_id[20]; /*學生學號;*/
float score[3]; /*三門課成績;*/
float total; /*總成績;*/
float aver; /*平均成績;*/
};
/*排序用一個函數來實現*/
void SortScore(student *stu,int n)
{
student stud;
for(int i = 0; i < n-1; i++)
for(int j = i+1 ; j < n; j++)
{
if(stu[i].total < stu[j].total)
{
stud = stu[i];
stu[i] = stu[j];
stu[j] = stud;
}
}
}
int main( )
{
student stu[STU_NUM]; /*創建結構體數組中有10個元素,分別用來保存這10個人的相關信息。*/
/*輸入這十個學生的相關信息*/
for(int i = 0; i<STU_NUM; i++)
{
printf("請輸入第%d個學生的學號:",i+1);
scanf("%s",&stu[i].stu_id);
printf("輸入第%d個學生的數學成績:",i+1);
scanf("%f",&stu[i].score[0]);
printf("輸入第%d個學生的英語成績:",i+1);
scanf("%f",&stu[i].score[1]);
printf("輸入第%d個學生的計算機成績:",i+1);
scanf("%f",&stu[i].score[2]);
stu[i].total = stu[i].score[0]+stu[i].score[1]+stu[i].score[2];
stu[i].aver = stu[i].total/3;
}
printf("\n");
SortScore(stu,STU_NUM);/*調用排序函數*/
/*輸出排序後的各學生的成績*/
for(i = 0 ; i < STU_NUM; i++)
{
printf("序號: %d\t",i);
printf("學號:%s\t",stu[i].stu_id);
printf("數學:%f\t",stu[i].score[0]);
printf("英語:%f\t",stu[i].score[1]);
printf("計算機:%f\t",stu[i].score[2]);
printf("平均成績:%f\t",stu[i].aver);
printf("總分:%f\t",stu[i].total);
printf("\n\n");
}
return 0;
}
註:(源程序中主要標識符含義說明)
#define STU_NUM 10 /*宏定義學生的數量*/
struct student /*定義一個結構體用來存放學生學號、三門課成績、總分及平均成績*/
{
char stu_id[20]; /*學生學號;*/
float score[3]; /*三門課成績;*/
float total; /*總成績;*/
float aver; /*平均成績;*/
}
E. 有一個類student,以下為其構造方法的聲明,正確的是() A.void student(int x){…} B.s(int x){…} C.
構造方法是一種特殊的方法,與一般的方法不同是: 1.構造方法的名字必須與定義他的類名完全相同,沒有返回類型,甚至連void也沒有。 2.構造方法的調用是在創建一個對象時使用new操作進行的。構造方法的作用是初始化對象。 3.不能被static、final、synchronized、abstract和native修飾。構造方法不能被子類繼承。
答案很明顯了吧。
F. C語言判斷題
對、對、對、錯、錯、錯、錯、錯、對、對
G. c語言是不存在字元串常量的對嗎char s[]=」student」是對的,
幾個問題回答如下:
Q:C語言是不存在字元串常量的對嗎?
A:是的,C語言是不存在字元串常量的,字元串在C語言中都是以字元數組的形式進行表達。
Q:char s[]="student"是對的,char s=student這個不存在對嗎?那char s,s=student這個可以嗎
A:char s=student,以及char s,s=student 這兩種用法都是不正確的。