當前位置:首頁 » 編程語言 » informc語言
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

informc語言

發布時間: 2022-11-30 02:03:57

A. 除了c語言還有哪些編程語言

很多很多,歷史上的編程語言大大小小加起來得上千種
目前排名前十的為
C,Python,Java,C++,C#,vb,JS,PHP,匯編,SQL
另外列出當前排名五十到一百的五十種小眾編程語言,僅供一笑
ActionScript, Alice, Arc, Awk, B4X, bc, BCPL, Bourne shell, CFML, CL (OS/400), Clipper, CLIPS, Common Lisp, Eiffel, Elixir, Elm, Forth, Fortress, Haskell, Icon, Inform, Io, J#, Korn shell, LiveCode, Maple, Mola-2, MQL4, MUMPS, NATURAL, NXT-G, Oberon, OCaml, Occam, OpenEdge ABL, PL/I, PostScript, PowerShell, Pure Data, Q, REXX, Ring, RPG, Simulink, Smalltalk, Solidity, SPARK, Stata, Uniface, Xojo

B. c的求平方根的問題

改好了,,錯誤不是一星半點啊- -
按你的意思改的

#include<stdio.h>
#include<math.h>

float result;
void inform();
void indata(float *);
void outdata(float);

void main()
{
float value;

for(inform();indata(&value),value;outdata(result))
result=(float)sqrt(value);
}

void inform()
{
printf("enter a value:\n");
}

void indata(float *value)
{
scanf("%f",value);
}

void outdata(float value)
{
printf("result is %f\n",value);
}

C. 尋C語言高手!!!

#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
typedef struct
{
int no;
char name[5];
int number;
}Data;
typedef struct node
{
Data inform;
struct node* next;
}LNode,*LinkList;

void Onit_LinkList(LinkList L);
LinkList Creat_LinkList(LinkList L);
void Print_LinkList(LNode* L);
LinkList Search_Data(int No,LinkList L);
LinkList In_Data(Data d,LinkList L);
void Out_Data(int No,int number,LinkList L);
LinkList Sort_LinkList(LinkList L);
LNode* Compare_NO(LinkList L);
LNode* Mix(LinkList L);
int main()
{
int option;
LNode* L;
L=(LNode*)malloc(sizeof(LNode));
Onit_LinkList(L);
do
{
cout<<"\n----------------------------------"
<<"請選擇相應的操作"
<<"------------------------------\n"
<<"1.........錄入貨物信息"<<endl
<<"2.........查找貨物並輸出相應信息"<<endl
<<"3.........加入貨物"<<endl
<<"4.........提取貨物"<<endl
<<"5.........輸出貨物信息"<<endl
<<"0.........退出倉庫管理系統"<<endl;
cin>>option;

switch(option)
{
case 0:
break;
case 1: L=Creat_LinkList(L);
break;
case 2:
{
int n1;
LinkList L1;
L1=(LNode*)malloc(sizeof(LNode));
cout<<"\n鍵入0退出查找。\n";
do
{
cout<<"\n輸入要查找的貨號:";
cin>>n1;
if(n1==0)break;
L1=Search_Data(n1, L);
if(L1==NULL)
{
cout<<"\n找不到指定的貨物!!!!\n";
}
else
{
cout<<"------------------------------------\n"
<<"貨物代號"<<setw(15)
<<"貨物名稱"<<setw(15)
<<"貨物數量"<<endl
<<L1->inform.no<<setw(18)
<<L1->inform.name<<setw(18)
<<L1->inform.number<<endl;
}
}while(n1);
break;
}
case 3:
{
LinkList L1;
L1=(LNode*)malloc(sizeof(LNode));
cout<<"鍵入0退出加入貨物。\n";
do
{
Data d;
cout<<"\n輸入加入的貨號:";
cin>>d.no;
L1=Search_Data(d.no,L);
if(d.no==0)break;
if(L1!=NULL)
{
cout<<"\n倉庫中已存在要加入的貨物,\n"
<<"只需輸入加入的數量:";
cin>>d.number;
}
else
{
cout<<"\n輸入貨物名稱及數量:";
cin>>d.name>>d.number;
}
L=In_Data(d,L);
}while(1);
break;
}
case 4:
{
LinkList L1;
L1=(LNode*)malloc(sizeof(LNode));
cout<<"\n鍵入0退出提取貨物。\n";
do
{
int No,number;
cout<<"\n輸入要提取貨號:";
cin>>No;
if(No==0)break;
L1=Search_Data(No,L);
if(L1==NULL)
{
cout<<"該貨物信息不存在!!!\n";
continue;
}
cout<<"------------------------------------\n"
<<"貨物代號"<<setw(15)
<<"貨物名稱"<<setw(15)
<<"貨物數量"<<endl
<<L1->inform.no<<setw(18)
<<L1->inform.name<<setw(18)
<<L1->inform.number<<endl;
cout<<"\n輸入提取貨物的數量:";
cin>>number;
Out_Data( No,number,L);
}while(1);
break;
}
case 5:
{
Print_LinkList(L);
break;
}
default:
cout<<"無效操作!!";
break;
}
}while(option);
return 0;
}

void Onit_LinkList(LinkList L)
{
L->next=NULL;
}
LinkList Creat_LinkList(LinkList L)
{
LNode *s,*r=L;
cout<<"鍵入0退出錄入。\n";
do
{
cout<<"\n輸入貨號:";
s=(LNode*)malloc(sizeof(LNode));
cin>>s->inform.no;
if(s->inform.no==0)
{
free(s);
break;
}
if(r->inform.no==s->inform.no)
{
cout<<"\n貨號重復!!!!\n";
continue;
}
cout<<"\n輸入貨物名稱及數量:";
cin>>s->inform.name
>>s->inform.number;
r->next=s;
r=s;
}while(1);
if(r!=NULL)r->next=NULL;
L=Sort_LinkList(L);
return L;
}
void Print_LinkList(LNode* L)
{
LNode *r=L;
if(L->next==NULL)cout<<"倉庫中無貨物\n";
else
{
cout<<"------------------------------------\n"
<<"貨物代號"<<setw(15)
<<"貨物名稱"<<setw(15)
<<"貨物數量"<<endl;
do
{
r=r->next;
cout<<r->inform.no<<setw(18)
<<r->inform.name<<setw(18)
<<r->inform.number
<<endl;

}while(r->next!=NULL);
}
}
LinkList Search_Data(int No,LinkList L)
{
LinkList r;
r=L->next;
while(r!=NULL && r->inform.no!=No)
r=r->next;
return r;
}
LinkList In_Data(Data d,LinkList L)
{
LinkList L1;
L1=(LNode*)malloc(sizeof(LNode));
L1=Search_Data(d.no,L);
if(L1==NULL)
{
LNode *r,*p,*s;
r=L->next;
s=L;
p=(LNode*)malloc(sizeof(LNode));
p->inform.no=d.no;
for(int i=0;i<6;i++)
{
p->inform.name[i]=d.name[i];
}
p->inform.number=d.number;
while(r->inform.no<d.no)r=r->next;
while(s->next!=r)s=s->next;
p->next=s->next;
s->next=p;
}
else
L1->inform.number +=d.number;
return L;
}
LinkList Sort_LinkList(LinkList L)
{
LinkList new_list;
LNode *r,*p,*mix;
new_list=(LNode*)malloc(sizeof(LNode));
new_list->next=NULL;
r=new_list;
mix=Mix(L);
do
{
p=(LNode*)malloc(sizeof(LNode));
p=Compare_NO(L);
r->next=p;
r=p;
}while(p->inform.no<mix->inform.no);
if(r!=NULL)r->next=NULL;
L=new_list;
return L;
}
void Out_Data(int No,int number,LinkList L)
{
LinkList L1;
L1=(LNode*)malloc(sizeof(LNode));
L1=Search_Data(No,L);
if(L1->inform.number>=number)
L1->inform.number-=number;
else
{
char p;
cout<<"\n該貨物庫存不足,是否提取(Y/N):";
cin>>p;
if(p=='y'||p=='Y')
{

cout<<"\n貨物"<<L1->inform.name<<endl
<<"提取了"<<L1->inform.number
<<"件,還需"<<number-L1->inform.number
<<"件才能滿足您的要求~~"<<endl;
L1->inform.number=0;

}

}

}
LNode* Compare_NO(LinkList L)
{
LNode *r,*p,*s;
s=(LNode*)malloc(sizeof(LNode));
p=L->next;
if(p->next==NULL)return p;
r=p->next;
while(r!=NULL)
{
if(p->inform.no>r->inform.no)p=r;
r=r->next;
}
*s=*p;
while(L->next!=p)L=L->next;
if(p->next==NULL)L->next=NULL;
else L->next=p->next;
free(p);
return s;
}
LNode* Mix(LinkList L)
{
LNode *r,*p,*s;
s=(LNode*)malloc(sizeof(LNode));
p=L->next;
if(p->next==NULL)return p;
r=p->next;
while(r!=NULL)
{
if(p->inform.no<r->inform.no)p=r;
r=r->next;
}
return p;
}
看看能用不

D. 又是C語言問題!!高手們幫幫忙吧!!

#include <stdio.h>
#define N 5
struct str0{ float a,b,c;};
struct str1{ char no[3];char name[15];struct str0 chengji;};
struct str1 inform[N]={ "01","ZhaoLi",{80.5,78,96}, "02","QianDuo",{67.5,69,78.5}, "03","SunMin",{95,95,95}, "04","LiQing",{78,82,86}, "05","LiYi",{79,86,66} };
void max(int * max)
{
int i;
for(i=1,*max=0;i<N;i++)
{
if(inform[*max].chengji.a<inform[i].chengji.a)
{
*max=i;
}
}
for(i=1,*(max+1)=0;i<N;i++)
{
if(inform[*(max+1)].chengji.b<inform[i].chengji.b)
{
*(max+1)=i;
}
}
for(i=1,*(max+2)=0;i<N;i++)
{
if(inform[*(max+2)].chengji.c<inform[i].chengji.c)
{
*(max+2)=i;
}
}
}
void main()
{
float ave;
int m[3];
max(m);
printf("C 最高分:%s ,%.1f\n",inform[m[0]].name,inform[m[0]].chengji.a);
printf("BD 最高分:%s ,%.1f\n",inform[m[1]].name,inform[m[1]].chengji.b);
printf("電路 最高分:%s ,%.1f\n",inform[m[2]].name,inform[m[2]].chengji.c);
}

問題很簡單,指針控制出錯了,裡面的*(++max)每循環一次指針就會移動一次,會導致指針指向溢出,改成*(p+N)形式來操作就可以了,能夠輸出正確的結果。
另外你的max函數裡面的形參名稱最後不要與函數名稱相同,還有就是裡面只能在已知科目數量的前提下判斷,所以有待改進,可以考慮給max函數傳遞一個科目數量形參。

E. 用鏈表(c語言)寫一個計算10位同學分數的程序 源文件:<stdio.h> <stdlib.h>

你要計算的是什麼分數?
typedef struct INFORM
{
char name[10];
int score[4];//由於看不懂你要計算什麼,留了每個人有四門成績
}INFORM STUDENT, INFORM *PSTUDENT;
typedef struct STU
{
STUDENT Node;
PSTUDENT Next;
}STU TLIST, STU *PTLIST;
int GetTotalScore(PTLIST pHead)//計算十個人某成績總分
{
int i = 0;
int nTotal = 0;
for(i = 0; i < 10; i++)
{
nTotal += pHead->Node.score[0];
pHead = pHead->Next;
}
return nTotal;
}

void GetEachScore(PTLIST pHead, int &StuSc[])//分別計算每個人總成績
{
int i = 0;
int j = 0;
for (i = 0; i < 10; i++)
{
for (j = 0; j < 4; j++)
{
StuSc[i] += pHead->Node.score[j];
}
pHead = pHead->Next;

}
}

F. C++語言的文件的寫入與讀取

首先說的是,c++其實讀取文件和c差不多,在你寫的代碼中,就輸出不同,其他一樣!
我說一下我自己在c++用的方法吧!
ifstream file("stu.txt");
if(!ifle)
cout<<"打開失敗";
char ch;
while(file.get(ch))
{
}
file.close();
就是這樣,其實c++也可以用上面你寫的!不懂再問!

G. c語言二級

#include<stdio.h>
structinform
{
charnumber[10];
intage;
charsex[3];
doublescore;
};
intmain()
{
structinformwang5;
scanf("%s%d%c%lf",wang5.number,&wang5.age,&wang5.sec,&wang5.score);
printf("%s%d%c%lf ",wang5.number,wang5.age,wang5.sec,wang5.score);
return0;
}

H. C語言程序 else 沒有與之匹配的if

疑似
else{
p1=p;
p=p->next;
}
中的else前少了個與switch配對的},所以這個else找不到配對的if了。

I. 數據結構演算法設計——統計二叉樹葉子結點的個數,並輸出結果

代碼如下:

#include<stdio.h>

#include<stdlib.h>

typedef struct BiTNode

{

char data;

struct BiTNode *lchild,*rchild;

}BiTNode,*BiTree;

void CreatTree(BiTree &A)

{

char ch;

scanf("%c",&ch);

if(ch=='#')

{

A=NULL;

}

else

{

A=new BiTNode;

A->data=ch;

CreatTree(A->lchild);

CreatTree(A->rchild);

}

}

int NodeTree(BiTree A)

{

if(A==NULL)

return 0;

else if(A->lchild==NULL&&A->rchild==NULL)

return 1;

else

return NodeTree(A->lchild)+NodeTree(A->rchild);

}

int main()

{

BiTree A;

int b;

printf("先序法賦值(空用#表示):");

CreatTree(A);

b=NodeTree(A);

printf("共有%d個葉子節點 ",b);

}

(9)informc語言擴展閱讀

二叉樹的性質

1、對於任意一棵二叉樹,如果其葉結點數為N0,而度數為2的結點總數為N2,則N0=N2+1;

2、有N個結點的完全二叉樹各結點如果用順序方式存儲,則結點之間有如下關系:

若I為結點編號則 如果I>1,則其父結點的編號為I/2;

如果2*I<=N,則其左孩子(即左子樹的根結點)的編號為2*I;若2*I>N,則無左孩子;

如果2*I+1<=N,則其右孩子的結點編號為2*I+1;若2*I+1>N,則無右孩子。

3、給定N個結點,能構成h(N)種不同的二叉樹。h(N)為卡特蘭數的第N項。h(n)=C(2*n,n)/(n+1)。

4、設有i個枝點,I為所有枝點的道路長度總和,J為葉的道路長度總和J=I+2i[2]

J. inform.c是啥意思

inFORM,這是由美國麻省理工學院媒體實驗室觸摸媒體小組開發的一種變形表面,能讓用戶以一種有趣的方式與數字產品互動,而不是傳統計算機的封閉式互動。