《C语言程序设计》项目设计

作者&投稿:荡官 (若有异议请与网页底部的电邮联系)
C语言程序设计的项目介绍要写什么~

1、项目产生的目的,开发一个软件,肯定是有用,才去开发的,如果这个软件没有存在的必要性那就不会去开发了。(学生直接写,学习软件开发流程,这个够完美的了)
2、软件的功能,能做什么,不能做什么。(软件是给人用的,不是你开发者使用的,开发者制定规则,使用者遵循开发者制定的规则来使用)

开发一个游戏吧, 贪吃蛇什么的。.如果嫌太简单,那么你可以修改一下,改成双人贪吃蛇..呵呵. ,如果嫌太简单,给成三人贪吃蛇好了

这种东西很多了,随便搜索一大堆:这是个学生成绩的!
#include <iostream.h>
#include <iomanip.h>
#include <fstream>
#include <vector>
#include <malloc.h>
#include <stdlib.h>
#include <string>
#include <process.h>
#include <stdio.h>
//#define NULL 0
int const Q=20;
#define LEN sizeof(struct student)
using namespace std;
int n=0; //定义一个全局变量统计学生人数
//——--------->定义一个学生考试信息的结构体
struct student
{
char name[Q]; //用来存放姓名的
char sex[Q]; //用来存放性别的
long int id; //用来存放准考证号的
int score[4]; //用来存放分数的
int total; //用来存放总分数的
struct student *next;
};
//student向量容器
vector <student> stu;
//-------------->学生类
class Information
{
public:
Information() ; //构造函数.
~Information() ; //析构函数.
student *creat();//建立链表函数。
void output(student *head);
int count(student *head);//定义函数count()统计考生总数
student *insert(student*head);//指针函数*insert()用来添加考生信息.
student *cancel(student *head,long int num);//指针函数*cancel()用来删除考生信息.
student *find(student *head,long int num); //指针函数*find()用来查找考生信息.
void inorder(student *head);//定义inorder()函数将考生的总分从大到小排列并输出
void average( student *head);//求学生成绩的平均分的函数
void save(student *head);//保存函数
student *Read();//读取函数
private:
student *p1,*p2,*p3,*head,st;
};
Information::Information()
{
cout<<" ******************************************************************************\n";
cout<<" ------------------------<<欢迎您使用学生成绩管理系统>>------------------------\n";
cout<<" ******************************************************************************\n\n";
}
Information::~Information()
{
cout<<" ******************************************************************************\n";
cout<<" ------------------------<<谢谢您使用学生成绩管理系统>>------------------------\n";
cout<<" ******************************************************************************\n";
}
student *Information::creat(void)
{//定义一个指向struct student的结构体指针函数*creat()用来增加考生信息.
char ch[Q];n=0; //用来存放姓名的
p1=p2=(student *)malloc(LEN);//调用malloc()函数用来开辟一个新的存储单元
cout<<" -------------<<请建立学生考试信息表,在姓名处键以 ! 结束输入。>>--------------"<<endl;
cout<<" 姓名:";
cin>>ch;
head=NULL; //给指针head赋初值
while (strcmp(ch,"!")!=0)
{//调用字符比较函数strcmp()用来判断是否继续输入
char str[10];
int flag=0;
p1=(student *)malloc(LEN);//调用malloc()函数用来开辟一个新的存储单元
strcpy(p1->name,ch); //将循环结构前面输入的姓名复制到结构体名为p1的数组name中
cout<<" 性别:";
cin>>p1->sex;

cout<<" 准考证号(8位):";
do{
cin>>str;
if(atol(str)>99999999 || atol(str)<1)
cout<<"对不起,请正确输入!!!\n";
else
{
p1->id=atol(str); flag=1;
}
}while(flag==0);

flag=0;

cout<<" 计算机组成原理成绩:";
do{
cin>>str;
if(atoi(str)>100 || atoi(str)<1)
cout<<"对不起,请输入1-100之间的数字!!\n";
else
{
p1->score[0]=atoi(str); flag=1;
}
}while(flag==0);

flag=0;

cout<<" 概率统计成绩:";

do{
cin>>str;
if(atoi(str)>100 || atoi(str)<1)
cout<<"对不起,请输入1-100之间的数字!!\n";
else
{ p1->score[1]=atoi(str); flag=1;}
}while(flag==0);

flag=0;

cout<<" 英语成绩:";

do{
cin>>str;
if(atoi(str)>100 || atoi(str)<1)
cout<<"对不起,请输入1-100之间的数字!!\n";
else
{ p1->score[2]=atoi(str); flag=1;}
}while(flag==0);
flag=0;

cout<<" C++成绩:";

do{
cin>>str;
if(atoi(str)>100 || atoi(str)<1)
cout<<"对不起,请输入1-100之间的数字!!\n";
else
{ p1->score[3]=atoi(str); flag=1;}
}while(flag==0);

flag=0;

p1->total=p1->score[0]+p1->score[1]+p1->score[2]+p1->score[3];//计算总分
if(n==0)head=p1;//如果是输入第一组学生考试信息就将指针p1赋给指针head
else p2->next=p1;//否则将p1赋给p2所指结构体的next指针
p2=p1;//将指针p1赋给指针p2
n++; //将n的值加1
cout<<" 姓名:";
cin>>ch;//将输入的姓名存放到字符数组ch中
}
p2->next=NULL;//将p2所指结构体的next指针重新赋空值
return (head);//将输入的第一组学生考试信息返回
}
//--------------->定义output()函数将考生的信息从头指针所指内容开始输出
void Information::output(student *head)
{

if(head==NULL) cout<<" 这是一个空表,请先输入考生成绩.\n";
else{
cout<<"-------------------------------------------------------------------------------\n";
cout<<" *学生考试成绩信息表*\n";
cout<<"-------------------------------------------------------------------------------\n";
cout<<"准考证号 姓 名 性别 计算机组成原理 概率统计 英语 C++ 平均分 总分\n";
cout<<"-------------------------------------------------------------------------------\n";
p1=head;//将头指针赋给p
do
{
cout<<setw(8)<<p1->id
<<setw(9)<<p1->name
<<setw(8)<<p1->sex
<<setw(13)<<p1->score[0]
<<setw(16)<<p1->score[1]
<<setw(10)<<p1->score[2]
<<setw(9)<<p1->score[3]
<<setw(6)<<p1->total/4.0
<<setw(11)<<p1->total<<endl;
cout<<"-------------------------------------------------------------------------------\n";
p1=p1->next;//将下一组考生信息的next指针赋给p
}while(p1!=NULL);//若指针p非空则继续,目的是把所有的考生信息都传给指针p然后输出.
}
}
//------------>统计学生人数的函数
int Information::count(struct student *head)//定义函数count()统计考生总数
{
if(head==NULL)
return(0);//若指针head为空返回值为0
else return(1+count(head->next));//函数的递归调用
}
//----------->插入学生的成绩的函数
student *Information::insert( student *head)
//插入新结点定义一个指向struct student的结构体指针函数*insert()用来添加考生信息.
{
char str[10];
int flag=0;
cout<<"\t----------------<<请输入新增学生成绩信息>>----------------\n"<<endl;
p1=(student *)malloc(LEN); //使p1指向插入的新结点
cout<<" 姓名:";
cin>>p1->name; //将输入的姓名存放到结构体名为p1的数组name中
cout<<" 性别:";
cin>>p1->sex;
cout<<" 准考证号(8位):";
do{
cin>>str;
if(atol(str)>99999999 || atol(str)<1)
cout<<"对不起,请请正确输入!!!\n";
else
{p1->id=atol(str); flag=1; }
}while(flag==0);

flag=0;

cout<<" 计算机组成原理成绩:";
do{
cin>>str;
if(atoi(str)>100 || atoi(str)<1)
cout<<"对不起,请输入1-100之间的数字!!\n";
else
{ p1->score[0]=atoi(str); flag=1;}
}while(flag==0);

flag=0;

cout<<" 概率统计成绩:";

do{
cin>>str;
if(atoi(str)>100 || atoi(str)<1)
cout<<"对不起,请输入1-100之间的数字!!\n";
else
{ p1->score[1]=atoi(str); flag=1;}
}while(flag==0);

flag=0;

cout<<" 英语成绩:";

do{
cin>>str;
if(atoi(str)>100 || atoi(str)<1)
cout<<"对不起,请输入1-100之间的数字!!\n";
else
{ p1->score[2]=atoi(str); flag=1;}
}while(flag==0);
flag=0;

cout<<" C++成绩:";

do{
cin>>str;
if(atoi(str)>100 || atoi(str)<1)
cout<<"对不起,请输入1-100之间的数字!!\n";
else
{ p1->score[3]=atoi(str); flag=1;}
}while(flag==0);

flag=0;

p1->total=p1->score[0]+p1->score[1]+p1->score[2]+p1->score[3];//计算总分
p2=head;//将头指针赋给p2
if(head==NULL) //若没调用次函数以前的头指针head为空
{
head=p1;p1->next=NULL;
}//则将p1赋给头指针head并将p1所指结构体成员指针next赋空值
else
{
while((p1->id>p2->id)&&(p2->next!=NULL))
{
p3=p2;//p3指向原p2指向的结点
p2=p2->next;
}//p2后移一个结点
if(p1->id<=p2->id)
{
if(head==p2)
{
p1->next=head;
head=p1;
} //插入到第一个结点之前
else
{
p3->next=p1;
p1->next=p2;
} //插入到p3所指结点之后
}
else
{
p2->next=p1;
p1->next=NULL;
} //插入到尾结点之后
}
n++;//将学生人数加1
cout<<"\t你输入的学生信息已经成功插入"<<endl;
return (head);
}
//------------>删除函数
student *Information::cancel(student *head,long int num)//定义一个指向struct student的结构体指针函数*delete()用来删除考生信息.
{

if(head==NULL)//若调用次函数以前的头指针head为空
{
return(head);
}
else
{
p1=head;//否则将头指针赋给p1
while(num!=p1->id&&p1->next!=NULL)//寻找要删除的结点当p1所指的学生准考证号不是输入的学生准考证号并且p1所指的next指针不为空
{
p2=p1;
p1=p1->next;
}//p2指向原p1指向的结点p1后移一个结点
if(num==p1->id)//如果输入的学生准考证号是p1所指的学生准考证号//结点找到后删除
{
if(p1==head) head=p1->next;//如果head指针和p1指针相等则将下一个结点赋给指针head
else
p2->next=p1->next;//否则将p1所指结点赋给p2所指结点将要删除的学生信息跳过去
cout<<" 删除准考证号为"<<num<<"的学生\n";
n--;//将学生人数减1
}
return(head);//将头指针返回
}
}
//------------>查找函数
student *Information::find(student *head,long int num)
//定义一个指向struct student的结构体指针函数*find()用来查找考生信息.
{

if(head==NULL)//若调用次函数以前的头指针head为空
{
cout<<" 这是一个空表,请先输入考生成绩.\n";
return(head);
}
else
{
p1=head;//否则将头指针赋给p1
while(num!=p1->id&&p1->next!=NULL)
//寻找结点当p1所指的学生准考证号不是输入的学生准考证号并且p1所指的next指针不为空
{
p1=p1->next;
}//p2指向原p1指向的结点p1后移一个结点
if(num==p1->id)//如果要查找的学生准考证号是p1所指的学生准考证号
{
cout<<"------------------------------------------------------------------------------\n";
cout<<"准考证号 姓名 性别 计算机组成原理 概率统计 英语 C++ 平均分 总分 \n";
cout<<"------------------------------------------------------------------------------\n";
cout<<setw(8)<<p1->id
<<setw(9)<<p1->name
<<setw(8)<<p1->sex
<<setw(13)<<p1->score[0]
<<setw(16)<<p1->score[1]
<<setw(10)<<p1->score[2]
<<setw(9)<<p1->score[3]
<<setw(6)<<p1->total/4.0
<<setw(11)<<p1->total<<endl;
cout<<"------------------------------------------------------------------------------\n";
}
else
cout<<" 没找到准考证号为"<<num<<"的学生.\n"; //结点没找到
return(head);
}
}
//------------定义inorder()函数将考生的总分从大到小排列并输出
void Information::inorder(student *head)
{
int i,k,m=0,j;
student *p[Q];//定义一个指向struct student的结构体指针数组p
if(head!=NULL)//如果头指针是空则继续
{ m=count(head);
cout<<"------------------------------------------------------------------------------\n";
cout<<"学生考试成绩统计表\n";
cout<<"------------------------------------------------------------------------------\n";
cout<<"准考证号 姓 名 性别 计算机组成原理 概率统计 英语 C++ 平均分 总分 名次\n";
cout<<"------------------------------------------------------------------------------\n";
p1=head;
for(k=0;k<m;k++)
{
p[k]=p1;
p1=p1->next;
}
for(k=0;k<m-1;k++) //选择排序法
for(j=k+1;j<m;j++)
if(p[k]->total<p[j]->total)
{
p2=p[k];
p[k]=p[j];
p[j]=p2;
} //从大到小排列的指针
for(i=0;i<m;i++)
{
cout<<setw(8)<<p1->id
<<setw(9)<<p1->name
<<setw(8)<<p1->sex
<<setw(13)<<p1->score[0]
<<setw(16)<<p1->score[1]
<<setw(10)<<p1->score[2]
<<setw(9)<<p1->score[3]
<<setw(6)<<p1->total/4.0
<<setw(11)<<p1->total<<endl;
cout<<"------------------------------------------------------------------------------\n";
}
}
}
//------------>求各科平均分成绩的函数

void Information::average(student *head)
{

int k,m;
float arg1=0,arg2=0,arg3=0,arg4=0;
if(head==NULL)//如果头指针是空则继续
{
cout<<" 这是一个空表,请先输入考生成绩.\n";
}
else
{
m=count(head);
p1=head;
for(k=0;k<m;k++)
{
arg1+=p1->score[0];
arg2+=p1->score[1];
arg3+=p1->score[2];
arg4+=p1->score[3];
p1=p1->next;
}
arg1/=m;arg2/=m;arg3/=m;arg4/=m;
cout<<"全班单科成绩平均分\n";
cout<<"------------------------------------------------------------------------------\n";
cout<<" 计算机组成原理平均分:"<<setw(7)<<arg1
<<" 概率统计平均分:"<<setw(7)<<arg2
<<" 英语平均分:"<<setw(7)<<arg3
<<" C++平均分:"<<setw(7)<<arg4<<endl;
cout<<"------------------------------------------------------------------------------\n";
}
}
//------------------->保存函数.
void Information::save(student *head)
{
ofstream out("data.txt",ios::out);
out<<count(head)<<endl;
while(head!=NULL)
{ out<<head->name<<"\t"
<<head->id<<"\t"<<"\t"
<<head->sex<<"\t"
<<head->score[0]<<"\t"
<<head->score[1]<<"\t"
<<head->score[2]<<"\t"
<<head->score[3]<<"\t"
<<head->total<<endl;
head=head->next;
}

}
//———————————>读取函数的实现
student *Information::Read()
{ int i=0;
p1=p2=( student *)malloc(LEN);
head=NULL;
ifstream in("data.txt",ios::out);
in>>i;
if(i==0){cout<<" data.txt 文件中的数据为空,请先输入数据。"<<endl; return 0;}
else {
cout<<" …………………………………………………………………………………………"<<endl;
for(;i>0;i--)
{ p1=(student *)malloc(LEN);
cin>>st.name>>st.id>>st.sex
>>st.score[0]>>st.score[1]>>st.score[2]>>st.score[3]
>>st.total;
strcpy(p1->name,st.name);
p1->id=st.id;
strcpy(p1->sex,st.sex);
p1->score[0]=st.score[0];
p1->score[1]=st.score[1];
p1->score[2]=st.score[2];
p1->score[3]=st.score[3];
p1->total=st.total;
if(n==0)head=p1;//如果是输入第一组学生考试信息就将指针p1赋给指针head
else p2->next=p1;//否则将p1赋给p2所指结构体的next指针
p2=p1;//将指针p1赋给指针p2
n++; //将n的值加1
//显示读入数据
cout<<" "<<p1->name<<"\t"
<<p1->id<<"\t"<<"\t"
<<p1->sex<<"\t"
<<p1->score[0]<<"\t"
<<p1->score[1]<<"\t"
<<p1->score[2]<<"\t"
<<p1->score[3]<<"\t"
<<p1->total<<endl;
cout<<" …………………………………………………………………………………………"<<endl;
//
}
cout<<" 数据已经成功读取完毕。"<<endl;
p2->next=NULL;
return (head);
}

}
//------------------------------>主函数.
int main(void)
{
Information person;
student *head=NULL;
char str[10];
int flag=0;
int choice;
long int i;
head=person.Read();
do{

cout<<"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓";
cout<<"┃ 学生成绩管理系统主菜单界面 ┃";
cout<<"┃ 读取数据请输入数字零 ┃";
cout<<"┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫";
cout<<"┃ ①.输入学生成绩 ┃";
cout<<"┃ ②.显示学生成绩 ┃";
cout<<"┃ ③.排序统计成绩 ┃";
cout<<"┃ ④.查找学生成绩 ┃";
cout<<"┃ ⑤.增加学生成绩 ┃";
cout<<"┃ ⑥.删除学生成绩 ┃";
cout<<"┃ ⑦.保存退出系统 ┃";
cout<<"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛";
cout<<"请输入您的选择(1--7):( )\b\b";

cin>>str;
if(atoi(str)>7 || atoi(str)<1)
cout<<"对不起,请输入1-7这几个数字!!\n";
else
{
choice=atoi(str);
switch(choice)
{
case 1:
head=person.creat();
break;
case 2:
person.output(head);
break;
case 3:
person.inorder(head);
person.average(head);
cout<<" 参加考试的学生人数为:"<<person.count(head)<<"人\n";
break;
case 4:
cout<<" 请输入要查找的准考证号(8位):";
do{
cin>>str;
if(atol(str)>99999999 || atol(str)<1)
cout<<"对不起,请输入正确输入!!!\n";
else
{i=atol(str); flag=1; }
}while(flag==0);

flag=0;
person.find(head,i);
break;
case 5:
head=person.insert(head);
person.output(head);
break;
case 6:
cout<<" 请输入要删除的准考证号(8位):";
do{
cin>>str;
if(atol(str)>99999999 || atol(str)<1)
cout<<"对不起,请输入正确输入!!!h\n";
else
{i=atol(str); flag=1; }
}while(flag==0);

flag=0;
head=person.cancel(head,i);
person.output(head);
break;
case 7:
person.save(head);
cout<<"文件已保存!可以安全退出!!!"<<endl;
break;
default :cout<<" 对不起,您的输入有误,请重新输入。\n";
break;
}
}
}while(choice!=7);

return 0;
}


c语言程序设计心得
C语言程序设计课程是高等院校计算机专业基础课程之一,其教学效果直接影响学生在计算机方面的应用。C语言是一门面向过程的、抽象化的通用程序设计语言,广泛应用于底层开发。C语言能以简易的方式编译、处理低级存储器。那么要如何写关于c语言程序设计心得呢?本文是c语言程序设计的心得,仅供参考。 c语言程序设计心得一 在...

C语言程序设计1+2\/3+3\/5+4\/7+5\/9+...的前20项之和
include <stdio.h> int main(){ int i;double s=0;for(i=1;i<21;i++)s+=(double)i\/(i+i-1);printf("%f\\n",s);return 0;}

计算机二级考试中 语言程序设计(包括C、C++、Java、Visual Basic、Delph...
是的,包括如下选择:(希望满意)二级C:DOS命令,计算机组成原理,多媒体、数据库操作、计算机网络、C语言程序设计、上机考试 二级C++:按照新大纲,教学内容有:C++语言概述、C++语言数据类型、运算符和表达式、基本控制语句、数组、指针与引用、函数、数和对象继承、模板等内容。二级VB:按照新大纲,教学...

C语言程序设计
一:D C C A A A C B C A 二:1):include<stdio.h> void main(){ int m,i,sum;printf("请输入要计算的整数:");scanf("%d",&m);for(i=1,sum=0;i<=m;i++)if (m\/i*i==m)sum+=i;printf("因子和sum=%d\\n",sum);} 2):include<stdio.h> void main(){ int m,...

帮忙《C语言程序设计》的题目
C) 是无限循环 D) 循环体一次也不执行 二、填空题(每小题2分,共10分)1、以下程序的输出结果为 2,3,2,2。main(){int i,j,m,n;i=1;j=2;m=++i;n=j++;printf("%d,%d,%d,%d",i,j,m,n);} 2、设 a 和 n 为整型变量,a=10,n=5,则表达式 a*=3+6 的值为90(你的...

C语言程序设计教程答案~有追加悬赏100分!
1 【C语言】《C语言程序设计教程(第二版)》习题答案 说明1. 本文所指的《C语言程序设计教程(第二版)》是李凤霞主编、北京理 工大学出版社出版的,绿皮。2第1章 程序设计基础知识 一、单项选择题(第23页) 1-4.CBBC 5-8.DACA二、填空题(第24页) 1.判断条件 2.面向过程编程 3.结构化 4.程序 5.面...

C语言程序设计:现代方法:第2版的目录
C语言程序设计:现代方法:第2版的目录  我来答 1个回答 #话题# 居家防疫自救手册 葱头52霅1 2016-06-05 · TA获得超过141个赞 知道答主 回答量:173 采纳率:0% 帮助的人:97.6万 我也去答题访问个人页 关注 展开全部 第1章 c语言概述 11.1 c语言的历史 11.1.1 起源 11.1.2 标准化...

C语言程序设计 求1+2+4+7+11+16+22+……前10项之和
所求数列:1 2 4 7 11……二级数列: 1 2 3 4……因此解题的方法也就很明确了,第一步就是先求出二级数列,第二步就可以求出目标数列,最后一步把目标数列各项加起来就得到正确结果了。C代码如下,代码可以求数列的前n项之和,n的值由自己设定,要求10项就键盘输入10...

求:C语言程序设计试卷及答案一份
C.2,E D.输出项与对应的格式控制不一致,输出结果不确定 31.若有定义:int a[3][4];,()不能表示数组元素a[1][1]。(本题分值:1分) 【正确答案】D A.*(a[1]+1) B.*(&a[1][1]) C.(*(a+1))[1] D.*(a+5) 32.若i、j已定义为int型,则以下程序段中内循环体的总的执行...

计算机二级C语言程序设计该怎么做?
如下:现在计算机二级考试程序设计题的环境是vs2010。vs2010是需要创建工程的,一个单独的文件是没有办法运行的,如果你使用的是考试软件,考试题里应该是有工程的,软件也应该能帮你自动打开vs2010工程,实在不行就自己创建。当然,你也可以不使用vs2010,用cfree,devc++这种不需要创建工程的软件,单独一...

温岭市15258942774: 《C语言程序设计》项目设计 -
闭贩洋参: 这种东西很多了,随便搜索一大堆:这是个学生成绩的! #include #include #include #include #include #include #include #include #include //#define NULL 0 int const Q=20; #define LEN sizeof(struct student) using namespace std; int n=0; //定义...

温岭市15258942774: 怎么用C语言做项目 -
闭贩洋参: 所谓项目,在一定的时间内,利用有限的资源和时间,完成特定的目的,这就是项目.Turbo C 是一种工具,它有它擅长的地方,也有它不擅长的地方我98年接过一个项目,用TC开发,结果失败,前前后后写了10000多行代码,只完成了一个...

温岭市15258942774: c语言程序设计 -- 对称数 -
闭贩洋参: #include #include int main(){ char str[10]={0}; int a,b, num,i,j; gets(str); num=strlen(str); a=atoi(str); ...

温岭市15258942774: C语言程序设计
闭贩洋参: #include<stdio.h>#include<stdlib.h>#include<string.h> int s; struct NODE{ char num[20]; char name[20]; int chinese; int english; int math; int totle;}a[100]; void Cin()//输入{ FILE *fp; int i; fp=fopen("E:\\score.txt","r"); for(s=0,i=0;!feof(fp);s++,i+...

温岭市15258942774: c语言程序设计 -
闭贩洋参: #includeint main(void){ int a,f; int b=0; int c=0; do{ printf("请输入您要输入的整数:"); scanf("%u",&a); if(a>0){ b++; } if(ac++; } printf("1 继续\t 0 退出\t"); fpurge(stdin); scanf("%d",f); }while(f!=0); printf("正数有:%d个.\n负数有:%d个.\n",b,c); return 0; }

温岭市15258942774: C语言程序设计
闭贩洋参: #include<stdio.h> int f(int n) {for(int i=2;i*i<=n;i++)if(n%i==0) return 0;return 1; } main() {int n,i,j,t;int k=0;scanf("%d",&n);printf("%d=",n);for(i=2;i<=n;i++){if(f(i)==1&&n%i==0){t=0;while(n%i==0){n=n/i;t++;}for(j=0;j<t;j++){if(k==0...

温岭市15258942774: C语言程序设计
闭贩洋参: C语言是一种面向过程的语言,在编程的时候,我觉得应该考虑程序的整体结构,如,我要实现一个数组的就地逆序,那么我应该要考虑哪一方面:1,数组的长度 2 直接将数组的前后相应的调换,如int a[6]; for(int i=0;i<3;i++){int temp;temp...

温岭市15258942774: C语言程序设计
闭贩洋参: #include"stdio.h" #include"string.h" void fun(char a[20][50],int n) { char t[50]; for(int i=0;i<n;i++) for(int j=i;j<n;j++) { if(strcmp(a[i],a[j])>0) { strcpy(t,a[i]); strcpy(a[i],a[j]); strcpy(a[j],t); } } } void main() { int i=-1,n; char x[20][50]; scanf("%d",&n); for(i=...

温岭市15258942774: c语言程序设计
闭贩洋参: //打印出100-999所有的"水仙花数" #include<stdio.h> main() { int g,s,b,n; for(n=100;n<=999;n++) { g=n%10; //分解出个位 s=m/10%10; //分解出十位 s=n/100; //分解出百位 if(n==g*g*g+s*s*s+b*b*b) printf("%d,",n); } }

温岭市15258942774: c语言程序设计
闭贩洋参: #include<stdio.h> void main() { int a[10][10],d,e; float b; for(d=0;d<10;d++) for(e=0;e<10;e++) scanf("%d",&a[d][e]); for(d=0;d<10;d++) {for(e=0,b=0;e<10;e++) b=b+a[d][e]; b=b/10; printf("%f\n",b);} }

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