#include<stdio.h>
#include<windows.h>
int xuanxiang;
int studentcount;
int banjihao[100];
int xueqihao[100][10];
char xm[100][100];
int xuehao[100][10];
int score[100][3];
int yuwen;
int shuxue[000];
int yingyu[100];
int c[100];
int p;
char x[1000][100]="",y[100][100]="";/*x學院 y專業 z班級*/
int z[100];
main()
{
void input();
void inputsc();
void alter();
void scbybannji();
printf("--------學生成績管理-----\n");
printf("請按相應數字鍵來實現相應功能\n");
printf("1.錄入學生信息 2.錄入學生成績 3.修改學生成績\n");
printf("4.查詢學生成績 5.不及格科目及名單 6.按班級輸出學生成績單\n");
printf("請輸入你要實現的功能所對應的數字:");
scanf("%d",&xuanxiang);
system("cls");
getchar();
switch (xuanxiang)
{
case 1:input();
case 2:inputsc();
case 3:alter();
/*case 4:select score();
case 5:bujigekemujimingdan();*/
case 6:scbybanji;
}
}
void input()
{
int i;
printf("請輸入你的學院名稱:");
gets(x);
printf("請輸入你的專業名稱:");
gets(y);
printf("請輸入你的班級號:");
scanf("%d",&z);
printf("請輸入你們一個班有幾個人:");
scanf("%d",&p);
system("cls");
for(i=0;i<p;i++)
{
printf("請輸入第%d個學生的學號:",i+1);
scanf("%d",xuehao[i]);
getchar();
printf("請輸入第%d個學生的姓名:",i+1);
gets(xm[i]);
system("cls");
}
printf("您已經錄入完畢您的班級所有學生的信息!\n");
printf("您的班級為%s%s%s\n",x,y,z);
/*alter(p);*/
}
void inputsc()
{
int i;
for(i=0;i<p;i++)
{
printf("\n");
printf("--------------------------------------------------------------------------------\n\n");
printf("\t\t\t\t錄入學生的成績\n\n\n");
printf("--------------------------------------------------------------------------------\n\n");
printf("\t\t\t\t%s\n",xm[i]);
printf("\n");
printf("\t\t\t\t數學:");
scanf("%d",&shuxue[i]);
printf("\n");
getchar();
printf("\t\t\t\t英語:");
scanf("%d",&yingyu[i]);
printf("\n");
getchar();
printf("\t\t\t\tc語言:");
scanf("%d",&c[i]);
system("cls");
}
}
void alter()
{
int i;/*循環變量*/
int m[10000];/*要查詢的學號*/
int b;/*修改后的成績*/
char kemu[20]="";
printf("請輸入你要修改的學生的學號");
scanf("%d",&m);
for (i=0;i<p;i++)
{
if (m==xuehao[i])
{
printf("%s的數學成績為%d,英語成績為%d,c語言成績為%d,xm[i],shuxue[i],yingyu[i],c[i]");
printf("請輸入你想修改的科目");}
}
gets(kemu);
getchar();
if (kemu=="數學");
{
scanf("%d",&b);
shuxue[i]=b;}
if (kemu=="英語");
{
scanf("%d",&b);
yingyu[i]=b;}
if (kemu=="c語言");
{
scanf("%d",&b);
c[i]=b;
}
printf("%s的數學成績為%d,英語成績為%d,c語言成績為%d,xm[i],shuxue[i],yingyu[i],c[i]");
}
void scbybannji()
{
int i;
char zyname[20];
int bjnumber;
printf("請輸入你的專業名稱");
scanf("%s",&zyname);
printf("請輸入你的班級號");
scanf("%d",&bjnumber);
for (i=0;i<p;i++)
{
if (zyname==y[i]);
if (bjnumber==z[i]);
printf("專業名稱%s班級號%d數學成績%d英語成績%dc語言成績%d,y[i],z[i],shuxue[i],yingyu[i],c[i]");
}
}
標簽:
c語言
上傳時間:
2018-06-08
上傳用戶:2369043090
%球體
close all;
G=6.67e-11;
R=2;%球體半徑
p=4.0;%密度
D=10.0;%深度
M=(4/3)*pi*R^3*p;%質量
x=-20:1:20;
g=G*M*D./((x.^2+D^2).^(3/2));
Vxz=-3*G*M*D.*x./((x.^2+D^2).^(5/2));
Vzz=G*M.*(2*D^2-x.^2)./((x.^2+D^2).^(5/2));
Vzzz=3*G*M.*(2*D^2-3.*x.^2)./((x.^2+D^2).^(7/2));
subplot(2,2,1)
plot(x,g,'k-');
xlabel('水平距離(m)');
ylabel('重力異常值');
title('球體重力異常Δg');
grid on
subplot(2,2,2)
plot(x,Vxz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vxz');
grid on
subplot(2,2,3)
plot(x,Vzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzz');
grid on
subplot(2,2,4);
plot(x,Vzzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzzz');
grid on
%%
%水平圓柱體
close all
G=6.67e-11;
p=10.0;%線密度
D=100.0;%深度
x=-200:1:200;
g=G*2*p*D./(x.^2+D^2);
Vxz=4*G*p*D.*x./(x.^2+D^2).^2;
Vzz=2*G*p.*(D^2-x.^2)./(x.^2+D^2).^2;
Vzzz=4*G*p.*(D^2-3.*x.^2)./((x.^2+D^2).^3);
subplot(2,2,1)
plot(x,g,'k-');
xlabel('水平距離(m)');
ylabel('重力異常值');
title('水平圓柱體重力異常Δg');
grid on
subplot(2,2,2)
plot(x,Vxz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vxz');
grid on
subplot(2,2,3)
plot(x,Vzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzz');
grid on
subplot(2,2,4);
plot(x,Vzzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzzz');
grid on
%%
%垂直臺階
G=6.67e-11;
p=4.0;%密度
h1=50.0;%下層深度
h2=40.0;%上層深度
x=-100:1:100;
g=G*p.*(pi*(h1-h2)+x.*log((x.^2+h1^2)./(x.^2+h2^2))+2*h1.*atan(x./h1)-2*h2.*atan(x./h2));
Vxz=G*p.*log((h1^2+x.^2)./(h2^2+x.^2));
Vzz=2*G*p.*atan((x.*(h1-h2))./(x.^2+h1*h2));
Vzzz=2*G*p.*x*(h1^2-h2^2)./((h1^2+x.^2).*(x.^2+h2^2));
subplot(2,2,1)
plot(x,g,'k-');
xlabel('水平距離(m)');
ylabel('重力異常值');
title('垂直臺階重力異常Δg');
grid on
subplot(2,2,2)
plot(x,Vxz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vxz');
grid on
subplot(2,2,3)
plot(x,Vzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzz');
grid on
subplot(2,2,4);
plot(x,Vzzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzzz');
grid on
%%
%傾斜臺階
G=6.67e-11;
p=4.0;%密度
h1=50.0;%下層深度
h2=40.0;%上層深度
a=pi/6;%傾斜角度
x=-500:1:500;
g=G*p.*(pi*(h1-h2)+2*h1.*atan((x+h1*cot(a))./h1)-2*h2.*atan((x+h2*cot(a))./h1)+x.*sin(a)^2.*log(((h1+x.*sin(a).*cos(a)).^2+x.^2.*sin(a)^4)./((h2+x.*(sin(a)*cos(a))).^2+x.^2.*sin(a)^4)));
Vxz=G*p.*(sin(a)^2.*log(((h1*cot(a)+x).^2+h1^2)./((h2*cot(a)+x).^2+h2^2))-2*sin(2*a).*(atan((h1/sin(a)+x.*cos(a))./(x.*sin(a)))-atan((h2/sin(a)+x.^cos(a))./(sin(a).*x))));
Vzz=G*p.*(0.5*sin(2*a)^2.*log(((h1*cot(a)+x).^2+h1^2)./((h2*cot(a)+x).^2+h2^2))+2*sin(a)^2.*(atan((h1/sin(a)+x.*cos(a))./(x.*sin(a)))-atan((h2/sin(a)+x.*cos(a))./(x.*sin(a)))));
Vzzz=2*G*p*sin(a)^2.*((x+2*h2*cot(a))./((h2*cot(a)+x).^2+h2^2)-(x+2*h1*cot(a))./((h1*cot(a)+x).^2+h1^2));
subplot(2,2,1)
plot(x,g,'k-');
xlabel('水平距離(m)');
ylabel('重力異常值');
title('傾斜臺階重力異常Δg');
grid on
subplot(2,2,2)
plot(x,Vxz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vxz');
grid on
subplot(2,2,3)
plot(x,Vzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzz');
grid on
subplot(2,2,4);
plot(x,Vzzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzzz');
grid on
%%
%鉛錘柱體
G=6.67e-11;
p=4.0;%密度
h1=50.0;%下層深度
h2=40.0;%上層深度
a=3;%半徑
x=-500:1:500;
g=G*p.*((x+a).*log(((x+a).^2+h1^2)./((x+a).^2+h2^2))-(x-a).*log(((x-a).^2+h1^2)./((x-a).^2+h2^2))+2*h1.*(atan((x+a)./h1)-atan((x-a)./h1))-2*h2.*(atan((x+a)./h2)-atan((x-a)./h2)));
Vxz=G*p.*log((((x+a).^2+h1^2).*((x-a).^2+h2^2))./(((x+a).^2+h2^2).*((x-a).^2+h1^2)));
Vzz=2*G*p.*(atan(h1./(x+a))-atan(h2./(x+a))-atan(h1./(x-a))+atan(h2./(x-a)));
Vzzz=2*G*p.*((x+a)./((x+a).^2+h2^2)-(x+a)./((x+a).^2+h1^2)-(x-a)./((x-a).^2+h2^2)+(x-a)./((x-a).^2+h1^2));
subplot(2,2,1)
plot(x,g,'k-');
xlabel('水平距離/m')
ylabel('重力異常值')
title('鉛垂柱體重力異常')
grid on
subplot(2,2,2)
plot(x,Vxz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vxz');
grid on
subplot(2,2,3)
plot(x,Vzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzz');
grid on
subplot(2,2,4);
plot(x,Vzzz);
xlabel('水平距離(m)');
ylabel('導數值');
title('Vzzz');
grid on
標簽:
MATLAB
重力
正
程序
上傳時間:
2019-05-10
上傳用戶:xiajiang