當前位置:首頁 » 編程軟體 » 編程顯示學號

編程顯示學號

發布時間: 2025-04-15 20:38:51

c語言編程,輸入一個學生的姓名、學號、英語、數學、計算機成績,輸出學生姓名、學號和平均成績

#include<stdio.h>

#include<string.h>

voidmain()

{

charname[20],number[20];

floatmath,english,computer;

doubleaver;

printf("Pleaseinputstudent'sname:");

gets(name);;

printf("Pleaseinputstudent'snumber:");

gets(number);

printf("Pleaseinputstudent'sEnglishscore:");

scanf("%f",&english);

printf("Pleaseinputstudent'sMathscore:");

scanf("%f",&math);

printf("Pleaseinputstudent'sComputerscore:");

scanf("%f",&computer);

aver=(english+math+computer)/3;

printf("Name:%s ",name);

printf("Number:%s ",number);

printf("Score:%5.2f ",aver);

}

輸入:

Pleaseinputstudent'sname:Lihua

Pleaseinputstudent'snumber:123456789

Pleaseinputstudent'sEnglishscore:80.5

Pleaseinputstudent'sMathscore:91

Pleaseinputstudent'sComputerscore:89.5

輸出:

Name:Lihua

NUmber:123456789

Score:87.00

⑵ 用c語言輸出顯示自己的姓名和學號,請寫出完整的程序代碼

#include"stdafx。h"

#include

intmain()

{

charszBuf[20]={0};

printf("請輸入姓名 ");

printf(">");

scanf("%s",szBuf);

intiNum=0;

printf("請輸入學號 ");

printf(">");

scanf("%d",&iNum);

printf("**************您的信息如下********************** ");

printf("姓名:%s ",szBuf);

printf("學號:%d ",iNum);

return0;

}

代碼具有較好的可移植性

C語言是面向過程的編程語言,用戶只需要關注所被解決問題的本身,而不需要花費過多的精力去了解相關硬體,且針對不同的硬體環境,在用C語言實現相同功能時的代碼基本一致,不需或僅需進行少量改動便可完成移植,這就意味著,對於一台計算機編寫的C程序可以在另一台計算機上輕松地運行,從而極大的減少了程序移植的工作強度。

以上內容參考:網路-c語言

⑶ 濡備綍鐢ㄧ紪紼嬬殑鏂規硶杈撳嚭濮撳悕鍜屽﹀彿

鐢╬ython緙栧啓涓涓紼嬪簭,杈撳嚭浣犵殑濮撳悕鍜屾帢鏃╁﹀彿鐨勬柟娉曘

濡備笅鍙傝冿細

1.杈撳叆鍛戒護鎻愮ず絎︼紝杈撳叆python騫舵寜Enter榪涘叆python浜や簰妯″紡銆

⑷ 請用c語言編程實現在計算機屏幕上分兩行輸出你的班級學號和姓名.

#include<stdio.h>
void
main(){
printf("班級:2015級計算機應用1班\n");
printf("學號:123456789
\t姓名:張三");
}
很簡單,就兩個輸出語句,\n意思就是換行,\t是空8個字元的位置

熱點內容
安卓手機usb偏好設置在哪裡 發布:2025-04-25 17:02:53 瀏覽:571
梁箍筋加密區間 發布:2025-04-25 17:02:10 瀏覽:423
大同忘記密碼找回多少錢 發布:2025-04-25 16:55:22 瀏覽:984
手機ip被加入黑名單限制訪問 發布:2025-04-25 16:40:51 瀏覽:730
內網的伺服器地址怎麼查 發布:2025-04-25 16:29:32 瀏覽:925
視頻緩存下載瀏覽器 發布:2025-04-25 16:21:53 瀏覽:1001
批量抖音腳本 發布:2025-04-25 15:58:10 瀏覽:836
運行極品飛車電腦要有什麼配置 發布:2025-04-25 15:51:35 瀏覽:418
sql動態傳參數 發布:2025-04-25 15:37:50 瀏覽:631
為啥keil不能編譯 發布:2025-04-25 15:20:35 瀏覽:66