c++问题 按下列要求实现一个有关学生成绩操作

作者&投稿:才旦钓 (若有异议请与网页底部的电邮联系)
c++问题 按下列要求实现一个有关学生成绩操作~

#include
#include
class Student
{
public:
char name[20];
int score[6];
int setmessage(void);
};
int Student::setmessage(void)
{
cout<<"姓名:";
cin>>name;
cout<<endl;
int i;
for(i=0;i<5;i++)
{
cout<<"该学生第"<<i+1<<"门成绩:"; //改为i+1好些
cin>>score[i];
cout<<endl;
}
score[5]=0; //这里要初始化
for(i=0;i<5;i++)
score[5]+=score[i]; ///溢出
return 0;
}

int main(void)
{
Student stu[5];
int count,max,i;
max=i=0;
for(count=0;count<5;count++)
{
stu[count].setmessage();//函数少了括号
}
while(i<5){
if(stu[max].score[5]<stu[i].score[5]) //把6改为5
max=i;
i++;
}
cout<<"最高分为"<<stu[max].name<<endl;
cout<<"分数为"<<stu[max].score[5]<<endl;

return 0;
}

#include
#include
#include
#include
#include
using namespace std;
class StuInfor
{
private:
int S_Position; //输出次序
string S_Number; //学号
string S_Name; //姓名
float S_Score_Math; //数学分数
float S_Score_Chinese; //语文分数
float S_Score_English; //英语分数
float S_Score_Totle; //总分
char S_Rank; //排名
string S_Other; //备注
bool Open_flag;
int Record;
public:
StuInfor();
virtual ~StuInfor();
void Cmenu(StuInfor &L); // 菜单函数
void ReadFromFile(StuInfor &L); // 读入数据
void PrintAll(StuInfor &L); // 打印全部
void SavetoFile(StuInfor &L); // 写入文件即保存
void Search_Listmember(StuInfor &L); // 查找成员
void Search_On_Name(StuInfor &L); // 按姓名查找
void Search_On_Number(StuInfor &L); // 按学号查找
void ModifyMember(StuInfor &L); // 修改成员数据
void DelMember(StuInfor &L); // 删除数据成员
void InsertMember(StuInfor &L); // 插入数据成员
};
StuInfor::StuInfor() // 构造函数进行一些初始化
{
Record=0;
Open_flag=false;
S_Rank=' ';
}
StuInfor::~StuInfor()
{
}
//////////////////////////////////////////////////////////////////////////
StuInfor stu[50]; //定义对象数组,来存放数据,每一个学生数据即是一个对象
//////////////////////////////////////////////////////////////////////////
void StuInfor::Cmenu(StuInfor &L) // 菜单函数实现
{
system("cls"); //清屏
cout<<"


Student Information Management System"<<endl;
cout<<"
Made By:月子 QQ:562888025
"<<endl;

cout<<"***************************************************************************
"<<endl;
cout<<" 1.Read From File 2.Print All List member"<<endl;
cout<<" 3.Search List member 4.Insert List member"<<endl;
cout<<" 5.Modify List member 6.Delete List member"<<endl;
cout<<" 7.Save To File 0.Exit System"<<endl;

cout<<"***************************************************************************
"<<endl;
cout<<"Please input a number above!"<<endl;
int i;
start:
cin>>i;
switch(i)
{
case 1:L.ReadFromFile(L);break;
case 2:L.PrintAll(L); break;
case 3:L.Search_Listmember(L);break;
case 4:L.InsertMember(L);break;
case 5:L.ModifyMember(L);break;
case 6:L.DelMember(L);break;
case 7:L.SavetoFile(L);break;
case 0:exit(1);break;
default:
{
cout<<"Error,please put a number again!"<<endl;
goto start; break;
}
}
}
void StuInfor::ReadFromFile(StuInfor &L)
{
system("cls"); //清屏
Open_flag=true;
ifstream filein;
filein.open("StuInfo.txt",ios_base::in); //输入流打开文件
if (!filein) //判断是否打开成功
{
cerr<<"
open error!"<<endl;
exit(1);
}
// cout<<setw(2)<<"次序"<<setw(8)<<" 学号"<<setw(5)<<" 姓名" //表头信息
// <<setw(6)<<" 数学成绩"<<setw(6)<<" 语文成绩"<<setw(6)
// <<" 英语成绩"<<setw(6)<<" 总分"<<" 总分排名"<<" 备注"<<endl;
// cout<<"****************************************************************************"<<endl;

for (int i=0;!filein.eof();i++) //遍历文件中的元素
{
filein>>stu[i].S_Position>>stu[i].S_Number>>stu[i].S_Name>>
stu[i].S_Score_Chinese >>stu[i].S_Score_Math>>stu[i].S_Score_English;
stu[i].S_Score_Totle=stu[i].S_Score_Chinese +stu[i].S_Score_Math+stu[i].S_Score_English;

// cout<<setw(2)<<stu[i].S_Position<<setw(13)<<stu[i].S_Number<<setw(6)<<stu[i].S_Name //输出所有信息
// <<setw(10)<<stu[i].S_Score_Chinese<<setw(10)<<stu[i].S_Score_Math<<setw(10)
// <<stu[i].S_Score_English<<setw(10)<<stu[i].S_Score_Totle<<stu[i].S_Rank<<endl;
Record=i;
}
cout<<" The Loading Finished!You can make other operations now!"<<endl;

filein.close(); //关闭文件
char temp; //临时定义用于输入的变量
cout<<"Continue to run the system?(y/n)"<<endl;
cin>>temp;
if (temp=='y')
{
L.Cmenu(L); //返回主菜单
}
else
exit(1);
}

void StuInfor::PrintAll(StuInfor &L)
{
system("cls");
char _load_temp='n';
if (!Open_flag)
{
cout<<"File hasn't loaded,and now load it?(y/n)"<<endl;
cin>>_load_temp;
if (_load_temp=='y')
{
L.ReadFromFile(L); //加载文件
}
else
L.Cmenu(L); //返回主菜单
}

cout<<setw(2)<<"次序"<<setw(8)<<" 学号"<<setw(5)<<" 姓名" //表头信息
<<setw(6)<<" 数学成绩"<<setw(6)<<" 语文成绩"<<setw(6)
<<" 英语成绩"<<setw(6)<<" 总分"<<" 总分排名"<<" 备注"<<endl;
cout<<"****************************************************************************"<<endl;
for (int i=0;i<=Record;i++) //遍历文件中的元素
{
stu[i].S_Score_Totle=stu[i].S_Score_Chinese +stu[i].S_Score_Math+stu[i].S_Score_English;

cout<<setw(2)<<stu[i].S_Position<<setw(13)<<stu[i].S_Number<<setw(6)<<stu[i].S_Name //输出所有信息
<<setw(10)<<stu[i].S_Score_Chinese<<setw(10)<<stu[i].S_Score_Math<<setw(10)
<<stu[i].S_Score_English<<setw(10)<<stu[i].S_Score_Totle<<stu[i].S_Rank<<endl;

}
cout<<" The Print Finished!"<<endl;
char temp; //临时定义用于输入的变量
cout<<"Continue to run the system?(y/n)"<<endl;
cin>>temp;
if (temp=='y')
{
L.Cmenu(L); //返回主菜单
}
else
exit(1);
}

void StuInfor::ModifyMember(StuInfor &L)
{
system("cls");
char _load_temp='n';
if (!Open_flag)
{
cout<<"File hasn't loaded,and now load it?(y/n)"<<endl;
cin>>_load_temp;
if (_load_temp=='y')
{
L.ReadFromFile(L); //加载文件
}
else
L.Cmenu(L); //返回主菜单
}
cout<<" Your position is at Modify list member Function!"<<endl;
int _Position;
cout<<"Please input the Position you want to Modify!"<<endl;
cin>>_Position;
int flag=1; //标识,用来标识是否找到要找的东西
char f,p;
for (int i=0;i<=Record;i++) //遍历文件中的信息
{

if(_Position==stu[i].S_Position) //以位置查找并打印查找到的东西
{
cout<<"What you want is:"<<endl; //打印出查找出来的东西
cout<<setw(2)<<"次序"<<setw(8)<<" 学号"<<setw(5)<<" 姓名" //表头信息
<<setw(6)<<" 数学成绩"<<setw(6)<<" 语文成绩"<<setw(6)
<<" 英语成绩"<<setw(6)<<" 总分"<<" 总分排名"<<" 备注"<<endl;
cout<<"****************************************************************************"<<endl;
cout<<setw(2)<<stu[i].S_Position<<setw(13)<<stu[i].S_Number<<setw(6)<<stu[i].S_Name //输出所有信息
<<setw(10)<<stu[i].S_Score_Chinese<<setw(10)<<stu[i].S_Score_Math<<setw(10)
<<stu[i].S_Score_English<<setw(10)<<stu[i].S_Score_Totle<<stu[i].S_Rank<<endl;
flag=0;
}
}
if(flag) //没有找到要找的元素,询问是否退出系统
{
cout<<"No find your position!
"<<endl;
cout<<"Continue to run the system?(y/n)"<<endl;
cin>>p;
if (p=='y')
{
L.Cmenu(L);
}
else
exit(1);
}
else //找到了要找的元素,可以进行操作了
{
cout<<"Do you want to Modify it?(y/n)"<<endl; //确认修改
cin>>f;
if (f=='y')
{
i=_Position-1; //逐项修改选中元素
cout<<"Now Please In put the new data!"<<endl;
cout<<"Input The new Number:"<<endl;
cin>>stu[i].S_Number;
cout<<"Input The new Name:"<<endl;
cin>>stu[i].S_Name;
cout<<"Input The new Chinese score:"<<endl;
cin>>stu[i].S_Score_Chinese;
cout<<"Input The new Math score:"<<endl;
cin>>stu[i].S_Score_Math;
cout<<"Input The new English score:"<<endl;
cin>>stu[i].S_Score_English;

cout<<"Succeed to Modify the data!
And do not forget to save befor leave!"<<endl;
}
else
{
cout<<"Failed to modify!"<<endl;
}

cout<<"Continue to run the system?(y/n)"<<endl; //是否继续操作系统
cin>>p;
if (p=='y')
{
L.Cmenu(L); //返回主菜单
}
else
exit(1);
}
}
void StuInfor::Search_Listmember(StuInfor &L)
{
system("cls");
char _load_temp='n';
if (!Open_flag)
{
cout<<"File hasn't loaded,and now load it?(y/n)"<<endl;
cin>>_load_temp;
if (_load_temp=='y')
{
L.ReadFromFile(L); //加载文件
}
else
L.Cmenu(L); //返回主菜单
}
system("cls");
cout<<" Your position is Serach Function!"<<endl;
cout<<"What would you like to sesrch on?"<<endl;
cout<<" 1.On Name 2 On Number 3 Quit Search"<<endl;
int i;
P_S_start:
cin>>i;
switch(i) //选择函数,按姓名查找或者按照学号查找
{

case 1: L.Search_On_Name(L); break;
case 2: L.Search_On_Number(L); break;
case 3: L.Cmenu(L);break;
case 0: exit(1);break;
default:cout<<"Wrong input!
Put a number again!"<<endl;goto P_S_start;break;
}
L.Cmenu(L);
}
void StuInfor::Search_On_Name(StuInfor &L)
{
system("cls");
string _Name;
cout<<" Your position is Serach on Name Function!"<<endl;
cout<<"Please input the Name you want!"<<endl;
int flag=1; //标识,用来标识是否找到要找的东西
cin>>_Name;
for (int i=0;i<=Record;i++) //遍历文件中的元素
{
if(_Name==stu[i].S_Name) //以学号查找并打印查找到的东西
{
cout<<"What you want is:"<<endl;
cout<<setw(2)<<"次序"<<setw(8)<<" 学号"<<setw(5)<<" 姓名" //表头信息
<<setw(6)<<" 数学成绩"<<setw(6)<<" 语文成绩"<<setw(6)
<<" 英语成绩"<<setw(6)<<" 总分"<<" 总分排名"<<" 备注"<<endl;
cout<<"****************************************************************************"<<endl;
cout<<setw(2)<<stu[i].S_Position<<setw(13)<<stu[i].S_Number<<setw(6)<<stu[i].S_Name //输出所有信息
<<setw(10)<<stu[i].S_Score_Chinese<<setw(10)<<stu[i].S_Score_Math<<setw(10)
<<stu[i].S_Score_English<<setw(10)<<stu[i].S_Score_Totle<<stu[i].S_Rank<<endl;
flag=0;
break;
}
}
if(flag) //没有找到要找的元素,询问是否退出系统
{
cout<<"No find the number you want!"<<endl;
}
char p;
cout<<"Continue to run the system?(y/n)"<<endl; //是否继续操作系统
cin>>p;
if (p=='y')
{
L.Cmenu(L);
}
else
exit(1);

}
void StuInfor::Search_On_Number(StuInfor &L)
{
system("cls");
string _Number;
cout<<" Your position is Serach on Number Function!"<<endl;
cout<<"Please input the Number you want!"<<endl;
int flag=1; //标识,用来标识是否找到要找的东西
cin>>_Number;
for (int i=0;i<=Record;i++) //遍历文件中的元素
{
if(_Number==stu[i].S_Number) //以学号查找并打印查找到的东西
{
cout<<"What you want is:"<<endl;
cout<<setw(2)<<"次序"<<setw(8)<<" 学号"<<setw(5)<<" 姓名" //表头信息
<<setw(6)<<" 数学成绩"<<setw(6)<<" 语文成绩"<<setw(6)
<<" 英语成绩"<<setw(6)<<" 总分"<<" 总分排名"<<" 备注"<<endl;
cout<<"****************************************************************************"<<endl;
cout<<setw(2)<<stu[i].S_Position<<setw(13)<<stu[i].S_Number<<setw(6)<<stu[i].S_Name //输出所有信息
<<setw(10)<<stu[i].S_Score_Chinese<<setw(10)<<stu[i].S_Score_Math<<setw(10)
<<stu[i].S_Score_English<<setw(10)<<stu[i].S_Score_Totle<<stu[i].S_Rank<<endl;
flag=0;
break;
}
}
if(flag) //没有找到要找的元素,询问是否退出系统
{
cout<<"No find the number you want!"<<endl;
}
char p;
cout<<"Continue to run the system?(y/n)"<<endl; //是否继续操作系统
cin>>p;
if (p=='y')
{
L.Cmenu(L);
}
else
exit(1);
}
void StuInfor::DelMember(StuInfor &L)
{
system("cls");
char _load_temp='n';
if (!Open_flag)
{
cout<<"File hasn't loaded,and now load it?(y/n)"<<endl;
cin>>_load_temp;
if (_load_temp=='y')
{
L.ReadFromFile(L); //加载文件
}
else
L.Cmenu(L); //返回主菜单
}
cout<<" Your position is Delete list member Function!"<<endl;
int _Position; //定义一个位置,用于输入
int k;
cout<<"Please input the Position you want to Delete!"<<endl;
cin>>_Position;
char f,p;
int flag=1; //标识,用来标识是否找到要找的东西
for (int i=0;i<=Record;i++)
{

if(_Position==stu[i].S_Position) //以位置查找并打印查找到的东西
{
k=i;
flag=0;
cout<<"What you want to delete is:"<<endl;
cout<<setw(2)<<"次序"<<setw(8)<<" 学号"<<setw(5)<<" 姓名" //表头信息
<<setw(6)<<" 数学成绩"<<setw(6)<<" 语文成绩"<<setw(6)
<<" 英语成绩"<<setw(6)<<" 总分"<<" 总分排名"<<" 备注"<<endl;
cout<<"****************************************************************************"<<endl;
cout<<setw(2)<<stu[i].S_Position<<setw(13)<<stu[i].S_Number<<setw(6)<<stu[i].S_Name //输出所有信息
<<setw(10)<<stu[i].S_Score_Chinese<<setw(10)<<stu[i].S_Score_Math<<setw(10)
<<stu[i].S_Score_English<<setw(10)<<stu[i].S_Score_Totle<<stu[i].S_Rank<<endl;
cout<<"Now Delete it!(y/n)"<<endl;
break;
}
}
cin>>f;
if(flag) //没有找到要找的元素,询问是否退出系统
{
cout<<"No find your position!"<<endl;
cout<<"Continue to run the system?(y/n)"<<endl;
cin>>p;
if (p=='y')
{
L.Cmenu(L); //返回主菜单
}
else
exit(1);
}
else //找到了元素,可以进行操作了
{
if (f=='y')
{
for (i=_Position-1;i<k;i++)
{
stu[i]=stu[i+1];
stu[i].S_Position--; //使位置自动更改
}
Record--;
cout<<"You succeed to Delete it!
And do not forget to save befor leave!"<<endl;
}
else
cout<<"Failed to Delete it"<<endl;
}
cout<<"Continue to run the system?(y/n)"<<endl; //是否继续操作系统
cin>>p;
if (p=='y')
{
L.Cmenu(L);
}
else
exit(1);

}
void StuInfor::InsertMember(StuInfor &L)
{
system("cls");
char _load_temp='n';
if (!Open_flag)
{
cout<<"File hasn't loaded,and now load it?(y/n)"<<endl;
cin>>_load_temp;
if (_load_temp=='y')
{
L.ReadFromFile(L); //加载文件
}
else
L.Cmenu(L); //返回主菜单
}
cout<<" Your position is at Insert list member Function!"<<endl;
int _Position;
cout<<"Please input the Position you want to insert element!"<<endl;
cin>>_Position;
char f,p;
int flag=1; //标识,用来标识是否找到要找的东西
int k;
for (int i=0;i<=Record;i++) //以位置查找并打印查找到的东西
{

if(_Position==stu[i].S_Position)
{
flag=0;
cout<<setw(2)<<"次序"<<setw(8)<<" 学号"<<setw(5)<<" 姓名" //表头信息
<<setw(6)<<" 数学成绩"<<setw(6)<<" 语文成绩"<<setw(6)
<<" 英语成绩"<<setw(6)<<" 总分"<<" 总分排名"<<" 备注"<<endl;
cout<<"****************************************************************************"<<endl;
cout<<setw(2)<<stu[i].S_Position<<setw(13)<<stu[i].S_Number<<setw(6)<<stu[i].S_Name //输出所有信息
<<setw(10)<<stu[i].S_Score_Chinese<<setw(10)<<stu[i].S_Score_Math<<setw(10)
<<stu[i].S_Score_English<<setw(10)<<stu[i].S_Score_Totle<<stu[i].S_Rank<<endl;
}
}
k=i;
if(flag) //没有找到要找的元素,询问是否退出系统
{
cout<<"No find your position!
"<<endl;
cout<<"Continue to run the system?(y/n)"<<endl; //是否继续操作系统
cin>>p;
if (p=='y')
{
L.Cmenu(L);
}
else
exit(1);
}
else //找到了要找的元素,可以进行操作了
{
cout<<"Now Insert an element to this position!(y/n)"<<endl;
cin>>f;
if (f=='y')
{
for(i++;i>=_Position;i--)
{
stu[i]=stu[i-1]; //插入位置后边的元素后移一位
stu[i].S_Position++; //位置加1
}
// stu[k].S_Position--;
Record++;
cout<<"Now Please Input the element data:"<<endl;
cout<<"Input The Number:"<<endl;
cin>>stu[i].S_Number;
cout<<"Input The Name:"<<endl;
cin>>stu[i].S_Name;
cout<<"Input The S_Score_Chinese:"<<endl;
cin>>stu[i].S_Score_Chinese;
cout<<"Input The S_Score_Math:"<<endl;
cin>>stu[i].S_Score_Math;
cout<<"Input The S_Score_English:"<<endl;
cin>>stu[i].S_Score_English;

cout<<"You succeed to insert an element to the position!
And do not forget to save befor leave!"<<_Position<<"!"<<endl;
}

else
cout<<"Failed to insert !"<<endl;
cout<<"Continue to run the system?(y/n)"<<endl; //是否继续操作系统
cin>>p;
if (p=='y')
{
L.Cmenu(L);
}
else
exit(1);
}
}

void StuInfor::SavetoFile(StuInfor &L)
{
system("cls");
char p;
char _load_temp='n';
if (!Open_flag)
{
cout<<"File hasn't loaded,and now load it?(y/n)"<<endl;
cin>>_load_temp;
if (_load_temp=='y')
{
L.ReadFromFile(L); //加载文件
}
else
L.Cmenu(L); //返回主菜单
}
ofstream ofile;
ofile.open("StuInfo.txt",ios_base::out);
for (int i=0;i<=Record;i++) //保存到文件中
{

ofile<<stu[i].S_Position<<' '<<stu[i].S_Number<<' '<<stu[i].S_Name<<' '<<
stu[i].S_Score_Chinese<<' '<<stu[i].S_Score_Math<<' '<<stu[i].S_Score_English<<endl;

}
ofile.close();
cout<<"Succeed to save!"<<endl;
cout<<"Continue to run the system?(y/n)"<<endl; //是否继续操作系统
cin>>p;
if (p=='y')
{
L.Cmenu(L);
}
else
exit(1);
}
int main()
{
StuInfor L;
L.Cmenu(L);
return 1;
}

错误在这:if (stu[i].ach>stu[i+1].ach),因为ach是private,所以不能直接访问,可以写个get方法。

正确程序如下:
#include<iostream.h>
#include<string.h>
class Student
{

public:
Student (char name1[]="",int a=0)
{
strcpy(name,name1);
ach=a;
}

void print()
{
cout<<name<<ach<<endl;
}

int getAch(){
return ach;
}
private:
int ach;

char name[20];

};
void main()
{
int i,max;

Student stu[5]={Student("A",95),Student("B",97),Student("C",94),Student("D",98),Student("E",99)};

for(i=0;i<4;i++)
{
if (stu[i].getAch()>stu[i+1].getAch())
max=i;
else
max=i+1;
}
stu[max].print();
}

cokac
162

qixp
749

xqow
548


丛台区17857593153: C++,按下列要求实现一个有关学生成绩的操作.. -
班荷来适: 程序设计如下:#include<iostream>using namespace std;typedef struct student{ int score; char name[10];}student;int main(){ student stu[5]; strcpy(stu[0].name , "小明"); stu[0].score = 50; strcpy(stu[1].name , "小江"); stu[1].score = 60; strcpy...

丛台区17857593153: 数制转换问题 C++【系统任务】任意给定一个M进制的数x ,请实现如下要求1)求出此数x的10进制值(用MD表示)2)实现对x向任意的一个非M进制的数的... -
班荷来适:[答案] #include #include #include #include using namespace std; char stack[100]; int top=-1; void push(char data) { stack[++top]=data; stack[top+1]='\0'; } char *convert(int a,int b) { char *ch=new char[100]; char *ch1=new char[100]; int i=0,j,k=0; while(a) { int t=a...

丛台区17857593153: 用C++实现以下要求:
班荷来适: #include&lt;iostream&gt; using namespace std; void main() { int i,k,count=0; cout&lt;&lt;"Input a number:"; do{ cin&gt;&gt;i; if(i&lt;0) cout&lt;&lt;"你输入的数字不合法!请重新输入!"&lt;&lt;endl; }while(i&gt;10000||i&lt;0); do{ k=i%10; //对i进行...

丛台区17857593153: 用C++语言按下列要求编程 -
班荷来适: class Rectangle { protected:double width; double length; public:Rectangle(double width,double length) { this.width=width; this.length=length; } double Circum() { return width*2+length*2; } double Area() { return width*length; } void setWidth(double width)...

丛台区17857593153: C++编程实现一个TIME类,要求: -
班荷来适: #include<stdio.h> class TIME { private:int hour;int min;int sec; public:// 默认参数构造函数TIME(int h=0, int m=0, int s=0) {if (h>23 || h<0 || m>59 || m<0 || s>59 || s<0) {// 参数非法,默认为0点hour = 0;min = 0;sec = 0;return;}hour = h;...

丛台区17857593153: 按下列要求建立单链表,编写程序的实现.要用C++编写. -
班荷来适: typedef struct node{char data[10];//定义结点的数据域为字符串struct node *next; //结点的指针域 }ListNode, *LinkList; typedef struct nodetotal{int count;//定义结点的数量struct node *next; //首个结点的指针 }NodeTotal, *SList;(1)按头插入...

丛台区17857593153: c++基础实践,编写程序,按照下面的要求实现:定义整型数组a[10],从键盘输入10个数为数组赋值 -
班荷来适: #include "stdio.h" #define N 10 void print(int b[]){int i;for(i=0;i<N;printf("%d ",b[i++]));printf("\n"); } void sort(int b[],int n){int i,j,k;for(i=0;i<n;i++){for(k=i,j=k+1;j<n;j++)if(b[k]>b[j])k=j;if(k-i)j=b[k],b[k]=b[i],b[i]=j;} } int main(int argc,char *...

丛台区17857593153: 关于C++数的计数问题(递归问题)我们要求找出具有下列性质数的个数(包含输入的自然数n):先输入一个自然数n(n≤1000),然后对此自然数按照如下方... -
班荷来适:[答案] 你的递归函数没有看太明白. 我写了一个,仅供参考: int js(int x) { int h=0,i; if(x==1) { return 1; } else { h =1; for(i=1;i

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网