當前位置:首頁 » 編程軟體 » 姓名學編程

姓名學編程

發布時間: 2022-08-07 10:46:56

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

❷ vb編程:輸入學生的姓名,學號和成績。成績包括高數、英語和專業課,判斷該生能獲幾等獎並輸出。

代碼如下。
======================
Private Sub Command1_Click()
Dim name As String, num As Integer, s1 As Single, s2 As Single, s3 As Single, s As String
name = InputBox("輸入學生的姓名")
num = Val(InputBox("輸入學生的學號"))
s1 = Val(InputBox("輸入高數成績"))
s2 = Val(InputBox("輸入英語成績"))
s3 = Val(InputBox("輸入專業課成績"))
If s1 > 95 And s2 > 95 And s3 > 95 Then
s = "一等"
Else
If s1 > 90 And s2 > 90 And s3 > 90 Then
s = "二等"
Else
If s1 > 88 And s2 > 88 And s3 > 88 Then
s = "三等"
Else
s = "無獎"
End If
End If
End If
MsgBox "學生" + name + "(學號" + Str(num) + ")的成績是" + vbCrLf + s
End Sub

❸ C語言編程!用姓名,學號,數學成績和語文成績描述一個學生的情況。編寫程序輸入5個人的情況,求每個學

看代碼:

#include<stdio.h>

typedefstruct
{
charname[20];
charid[20];
floatmath_score;
floatlang_score;
}student;

#defineN5
intmain(intargc,char**argv)
{
inti;
studentstu[N];
for(i=0;i<N;++i)
{
printf("輸入第%d個學生的信息(順序為姓名,學號,數學成績,語文成績,並用空格分開): ",i+1);
scanf("%s%s%f%f",stu[i].name,stu[i].id,&stu[i].math_score,&stu[i].lang_score);
}

printf(" ");
for(i=0;i<N;++i)
{
printf("第%d個學生的信息: ",i+1);
printf("姓名:%s學號:%s數學成績:%.1f語文成績:%.1f總分:%.1f ",
stu[i].name,stu[i].id,stu[i].math_score,stu[i].lang_score,stu[i].math_score+stu[i].lang_score);
}

return0;
}

運行:

❹ 用C語言編程輸出姓名和學號,該怎麼編程

這幾天好多人在問這個問題!
是校的作業吧!
還是自己做一下。
不會細接的再問人吧!
要不你們做出的題是一樣的不氣死teacher!

❺ 求C語言編程實現由鍵盤輸入3個學生的信息(包括學號、姓名、成績)程序運行後按照成績的高低順序輸出各學生的

#include<stdio.h>
struct Stu
{
int num;
char name[20];
float score;
};
void Input(struct Stu s[])
{
int i;
for(i=0;i<3;++i)
scanf("%d%s%f",&s[i].num,s[i].name,&s[i].score);
}
void Sort(struct Stu *a[])
{
int i,j;
struct Stu *t,**p;
for(i=0;i<2;++i)
{
p=a+i;
for(j=i+1;j<3;++j)
if((*p)->score<a[j]->score)p=a+j;
if(p!=a+j)
{
t=*p;
*p=a[i];
a[i]=t;
}
}
}
int main()
{
struct Stu s[3],*a[3];
int i;
Input(s);
for(i=0;i<3;++i)
a[i]=&s[i];
Sort(a);
for(i=0;i<3;++i)
printf("%d %s %.2f\n",a[i]->num,a[i]->name,a[i]->score);
return 0;
}

❻ C語音編程題(一個班級有N個學生,每個學生有學號、姓名,學生學習課程語文、數學、英語)

#include<stdio.h>

intn=0;

printf("請輸入有多少個學生: ");

printf("請輸入第%d名學生的學號: ",i+1);

scanf("%u",&stu[i].stuNum);

getchar();

printf("請輸入第%d名學生的姓名: ",i+1);

scanf("%d",&stu[i].scoreCh);

getchar();

printf("請輸入第%d名學生的數學分數: ",i+1);

scanf("%d",&stu[i].scoreMath);

getchar();

printf("請輸入第%d名學生的英語分數: ",i+1);

if(stu[j].totalScore>stu[j+1].totalScore)

{

studenttempStu;

printf("名次學號姓名語文數學英語總分平均分 ");

for(i=0;i<n;i++)

return0;

}

簡潔的語言

C語言包含的各種控制語句僅有9種,關鍵字也只有32個,程序的編寫要求不嚴格且以小寫字母為主,對許多不必要的部分進行了精簡。實際上,語句構成與硬體有關聯的較少,且C語言本身不提供與硬體相關的輸入輸出、文件管理等功能,如需此類功能,需要通過配合編譯系統所支持的各類庫進行編程,故c語言擁有非常簡潔的編譯系統。

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

❼ 用C語言從鍵盤任意輸入5個學生的姓名,編程找出並輸出按字典順序排在最前面的學生姓名

#include<stdio.h>
#include<string.h>

intmain(){
chara[5][1000],tem[1000];
inti,k;
for(i=0;i<5;i++){
scanf("%s",a[i]);
}
for(i=1;i<5;i++){
if(strcmp(a[0],a[i])==1){
strcpy(a[0],a[i]);
}
}
printf("%s ",a[0]);
return0;
}

❽ 急求!編程實現輸入一個學生的姓名學號,及三門功課成績,計算每個學生平均分;輸入學號,輸出該學生數據

#include <stdio.h>

#include <stdlib.h>


typedef struct {

char id[16]; // 學生編號

float scores[3]; // 語文數學英語成績

}Student;


int main() {

Student student;

printf("請輸入學生的編號 語文成績 數學成績 英語成績 ");

scanf("%s%g%g%g", student.id, &student.scores[0], &student.scores[1], &student.scores[2]);

printf("學生信息如下: ");

printf("編號:%s ", student.id);

printf("語文數學以及英語成績:%g %g %g ", student.scores[0], student.scores[1], student.scores[2]);

printf("平均成績:%g ", (student.scores[0] +student.scores[1] + student.scores[2])/3);

return 0;

}

❾ 如何用C語言編寫自己的姓名和學號

可以參考下面的代碼:

#include <stdio.h>

#include <stdlib.h>

int main(void)

{

FILE *fp=fopen("data.txt","r");

if (!fp)

{

fp=fopen("data.txt","w");

printf("請輸入姓名:");

char *name;

scanf("%s",name);

printf("請輸入學號:");

char *num;

scanf("%s",num);

fprintf("%s %s",name,num);

fclose(fp);

return 0;

}

char *name,*num;

fscanf("%s %s",name,num);

fclose(fp);

printf("姓名為:%s 學號為:%s",name,num);

return 0;

}

(9)姓名學編程擴展閱讀:

1、printf()函數

printf()函數是格式化輸出函數, 一般用於向標准輸出設備按規定格式輸出

信息。在編寫程序時經常會用到此函數。函數的原型為:

int printf(const char *format, ...);

函數返回值為整型。若成功則返回輸出的字元數,輸出出錯則返回負值。

2、scanf()

函數 scanf() 是從標准輸入流stdin(標准輸入設備,一般指向鍵盤)中讀內容的通用子程序,可以說明的格式讀入多個字元,並保存在對應地址的變數中。

❿ 用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語言

熱點內容
阿里雲伺服器能用vmware嗎 發布:2024-04-25 13:33:23 瀏覽:731
1616源碼 發布:2024-04-25 13:33:19 瀏覽:80
奧維地圖伺服器地址怎麼填 發布:2024-04-25 12:40:04 瀏覽:965
低配置游戲玩哪個平台 發布:2024-04-25 12:35:04 瀏覽:559
glinux下載 發布:2024-04-25 12:30:09 瀏覽:84
安卓手機可以用的谷歌叫什麼 發布:2024-04-25 12:05:57 瀏覽:943
linux改變用戶所屬組 發布:2024-04-25 11:50:33 瀏覽:469
rsa加密演算法java代碼 發布:2024-04-25 11:40:07 瀏覽:883
如何改變拉桿箱上的初始密碼 發布:2024-04-25 11:17:23 瀏覽:799
內網掛代理虛擬機如何配置網卡 發布:2024-04-25 11:15:06 瀏覽:687