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,这是由美国麻省理工学院媒体实验室触摸媒体小组开发的一种变形表面,能让用户以一种有趣的方式与数字产品互动,而不是传统计算机的封闭式互动。