編程顯示學號
⑴ 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個字元的位置