导航:首页 > 源码编译 > tc源码下载

tc源码下载

发布时间:2022-08-08 08:33:24

‘壹’ 求大富翁源代码

#include<iostream.h>
#include<iomanip.h>
#include<string.h>

#define _GOLD 2 //标志有金子的格子
#define _TRAP 3 //标志有陷阱的格子
#define _OBSTACLE 4 //标志有障碍物的格子

class simgame
{
public:
simgame(char *nm,int);
void terminate(){delete []name;};
void init(int data[],int n);
void run();
void display();
private:
char *name;
int way[50]; //标志环道格子种类的数组
int location;
int life;
int money;
int isdead; //判断是否死亡
int isforward; //判断是顺行还是逆行
};

simgame::simgame(char *nm,int isfd=1)
{
strcpy(name,nm);
isforward=isfd;
location=0;
life=money=100;
isdead=0;
}

void simgame::init(int data[],int n)
{
int nn=0; //用于循环data数组以保证把way数组完整赋值
int i;
way[0]=0;
if(isforward)
{
for(int i=1;i<50;i++)
{
if(nn=n)nn=0; //如果data数组到达末尾,从头开始
way[i]=data[nn];
nn++;
}
}
else
{
nn=n-1;
for(i=1;i<50;i++)
{
if(nn<0)nn=n-1;
way[i]=data[nn];
nn--;
}
}
}

void simgame::display()
{
cout<<"老鼠"<<name<<":";
if(life>0)
{
cout<<"位置="<<setw(5)<<location;
cout<<"生命="<<setw(5)<<life;
cout<<"金钱="<<setw(5)<<money;
}
else
cout<<"Dead!";
}

void simgame::run()
{
int i;
int isstop=0;
if(isdead)return;
if(isforward) //正常行走的过程
{
for(i=1;i<5;i++)
{
if(location+i==50)
location-=50; //如果到达末尾则从头开始走,并把位置变量重新赋值
if(way[location+i]==_OBSTACLE) //如果途中有障碍物,则停止
{
location+=i;
isstop=1; //标志,表示是否停留
break;
}
}
if(!isstop)
location+=4;
switch(way[location])
{
case _GOLD:money+=50;break;
case _TRAP:life-=80;break;
default:break;
}
if(life<=0)isdead=1;
}
else //逆行的过程
{
for(i=1;i<4;i++)
{
if(location+i==50)
location-=50;
if(way[location+i]==_OBSTACLE)
{
location+=i;
isstop=1;
break;
}
}
if(!isstop)
location+=3;
switch(way[location])
{
case _GOLD:money+=50;break;
case _TRAP:life-=80;break;
default:break;
}
if(life<=0)isdead=1;
}
}

void main()
{
simgame mice1("A");
simgame mice2("B",0);
int data[20]={1,2,2,2,3,2,3,4,1,2,3,4,1,2,3,4,3,2,2,1};
mice1.init(data,20);
mice2.init(data,20);
for(int i=0;i<5;i++)
{
mice1.run();
mice2.run();
cout<<"轮次:"<<i+1<<endl;
mice1.display();
mice2.display();
}
mice1.terminate();
mice2.terminate();
}
可以编译,但不可以运行,求大虾给诊断一哈,谢谢谢谢
问题补充:题目:一条由50个格子组成的环形跑道,其中一个格子是起点,两只鼠都从起点按相反方向出发,一只鼠按正方向前进且每次前进4格,另一只鼠按反方向出发,且每次前进3个格子,每只鼠出发时都有100点生命值和100个金子;跑道由普通格子,带金币的格子,带陷阱的格子,带障碍的格子等四种组成!

规则:a,起点是普通格子,任何普通格子鼠可以顺利通过.
b.鼠每路过或停在一个带金币的格子上就增加50个金币
c.鼠停留在陷阱的格子上,损失生命80点.
d.鼠路过带障碍的格子时,本轮停止前进.

1.并实现相关的类,同时模拟此游戏
输入:已在main()中提供一个大小为20的一维整型数组data,数值可为1,2,3,4,分别表示四种类型的格子,其中data(0)表示起点.
输出:10轮次内,每轮走完后两只老鼠的各自位置,生命,和拥有的金币数.

要main()函数应为如下格式
void main()
{
int data[20]={1,2,2,2,3,2,3,4,1,2,3,4,1,2,3,4,3,2,2,1};
simgame game;
game.init(data,20);
game.run(5)
game.terminate();
}

输出:
轮次1:
老鼠A:位置=##生命=##金钱=##
老鼠B:位置=##生命=##金钱=##
轮次2:
.......
宏:
#define _GOLD 2 //金子
#define _TRAP 3 //陷阱
#define _OBSTACLE 4 //障碍物

‘贰’ 求C语言编译器代码

c语言编译器源代码
运行环境:9x/Me/NT/2000/XP/
源码语言:简体中文
源码类型:编程源码 - VC++源码
下载地址:http://down2.newasp.net/code/vc/cvery_4136142.rar
或:http://www.newasp.net/code/vc/2445.html

visual c++ 功能强大,不过需要的容量也很大 ,
TC2.0也不错 很适合初学者 不过不是很标准 下面有它们的下载网站 你自己根据自己的情况,自己选择吧,我的建议是VC6.0

TC2.0的:
http://218.64.170.103/dload1.html?cid=

http://218.64.170.103/dload1.html?cid=

VC6.0 的:
http://218.64.170.103/dload1.html?cid=

http://218.64.170.103/dload1.html?cid=
-----------------------------------
TC 比较基础,运行也比较快,但是是DOS界面
win-tc 是tc的windows版本,图形化界面,很好使用。
VC 适合windows平台。集成开发环境。调试方便。
[
在http://msdn.microsoft.com/visualc/vctoolkit2003/
网站点击( Download the Visual C++ Toolkit 2003 )
]
GCC 用于Linex,但是也有windows版本。移植性比较好
另外还有c-free,div c等,也可以在windows下使用

‘叁’ 在线等待 关于绩点计算器的TC源代码

你的代码错误很多,由于不知道你要实现的功能,只能暂时改掉错误,编译运行通过了,但是不保证实现你要求的功能。你参考一下吧
#include<stdio.h>
struct data
{
int score;
int credit;
};
void enter(struct data a[],int n);
float point(struct data a[],int n);
float totalpoint(struct data point[],int n);
void main()
{
int n;
struct data data1[30];
float b;
printf("Plese input the sum of the subjects(n<=30):");
scanf("%d",&n);
enter(data1,n);
point(data1,n);
b=totalpoint(data1,n);
printf("Your totalpoint is:%f",b);
}
void enter(struct data a[],int n)
{
int i;
printf("Please input the data(score,credit):");
for(i=0;i<n;i++)
{ printf("Please input %d data:",i+1);
scanf("%d %d",&a[i].score,&a[i].credit);
}
}
float point(struct data a[],int n)
{
int i;
for(i=0;i<n;i++)
{
if(a[i].score>=90)return 4;
else if(a[i].score>=85)return 3.7;
else if(a[i].score>=82)return 3.3;
else if(a[i].score>=78)return 3.0;
else if(a[i].score>=75)return 2.7;
else if(a[i].score>=72)return 2.3;
else if(a[i].score>=68)return 2.0;
else if(a[i].score>=66)return 1.7;
else if(a[i].score>=64)return 1.5;
else if(a[i].score>=60)return 1.0;
else return 0;
}
}
float totalpoint(struct data point[],int n)
{
int i;
float a,c,b;
for(i=0;i<n;i++)
{
a=point[i].score;
a=a+a;
c=point[i].credit;
c=c+c;
}
b=a/c;
return b;
}

‘肆’ 谁有TC源代码

这东西应该没有的吧,人家还要靠他赚钱呢,不可能开放源代码给你的
------淡淡仙恋------

‘伍’ 求解TC小型计算器C语言源代码

#include<stdio.h>
main()
{
int a,b;
char ch;
printf("请输入表达式如:1+2 \n");
scanf("%d%c%d",&a,&ch,&b);
if(ch=='/' && b==0)
printf("被除数为0请检查表达式是否出错?");
else
{ switch(ch)
{
case '+': printf("%d+%d=%d\n",a,b,a+b);break;
case '-': printf("%d-%d=%d\n",a,b,a-b);break;
case '*': printf("%d*%d=%d\n",a,b,a*b);break;
case '/': printf("%d/%d=%d\n",a,b,a/b);break;
}
}
}

‘陆’ 谁有TC写的计算器程序源代码

#include<iostream.h> #include<malloc.h> #include<string.h> typedef struct{ int item; long num; char p; }S1; typedef struct{ int lv; char p; }S2; S1 *S=(S1*)malloc(sizeof(S1)); S2 *P=(S2*)malloc(sizeof(S2)); long l1=0,l2=0; void S1I(void){ if(!l1)S=(S1*)realloc(S,sizeof(S1)); else S=(S1*)realloc(S,sizeof(S1)*l1); }void S2I(void){ if(!l2)P=(S2*)realloc(P,sizeof(S2)); else P=(S2*)realloc(P,sizeof(S2)*l2); }int L(char n){ switch(n){ case '+':case '-':return(1); case '*':case '/':return(2); case '(':return(3); case ')':return(4); default:return(5); } }void O(char n[]){ int i,s=strlen(n),k; for(i=0;i<s;i++){ k=L(n[i]); if(k==5){ l1++; S1I(); S[l1-1].item=0; S[l1-1].num=0; for(;i<s;i++){ if(n[i]<'0'||n[i]>'9'){i--;break;} S[l1-1].num*=10; S[l1-1].num+=(n[i]-'0'); }continue; }if(l2==0||k==3){ l2++; S2I(); P[l2-1].lv=k; P[l2-1].p=n[i]; continue; }if(k!=4){ for(;l2>0;){ if(P[l2-1].lv<k||P[l2-1].lv==3)break; l1++; S1I(); S[l1-1].item=1; S[l1-1].p=P[l2-1].p; l2--; S2I(); }l2++; S2I(); P[l2-1].lv=k; P[l2-1].p=n[i]; continue; }for(;l2>1;){ if(P[l2-1].lv==3)break; l1++; S1I(); S[l1-1].item=1; S[l1-1].p=P[l2-1].p; l2--; S2I(); }l2--; S2I(); }for(;l2>0;){ l1++; S1I(); S[l1-1].item=1; S[l1-1].p=P[l2-1].p; l2--; S2I(); }l2=l1; }long sum(int a,int b,char p){ switch(p){ case '+':return(a+b); case '-':return(a-b); case '*':return(a*b); default:return(a/b); } }long sum(int s){ long sk; if(!S[s-2].item){ if(!S[s-3].item){ l2=s-3; sk=sum(S[s-3].num,S[s-2].num,S[s-1].p); return(sk); }else{ sk=sum(sum(s-2),S[s-2].num,S[s-1].p); return(sk); } }else{ sk=sum(s-1); if(!S[l2-1].item){ sk=sum(S[l2-1].num,sk,S[s-1].p); return(sk); }else{ sk=sum(sum(l2),sk,S[s-1].p); return(sk); } } }void main(){ char n[100]; cin>>n; O(n); cout<<sum(l1)<<endl; } 不知道TC支不支持,VC下测试通过.暂时只支持所有计算后结果小于1e7,且没有错误,只使用+-*/的计算

‘柒’ 求~~!在TC下的程序源代码!~《学生成绩查询系统》

#include "stdio.h" /*I/O函数*/
#include "stdlib.h" /*其它说明*/
#include "string.h" /*字符串函数*/
#include "conio.h" /*屏幕操作函数*/
#include "mem.h" /*内存操作函数*/
#include "ctype.h" /*字符操作函数*/
#include "alloc.h" /*动态地址分配函数*/
struct score
{
int mingci;
char xuehao[8];
char mingzi[20];
float score[6];
}data,info[1000];
int i,j,k=0;
char temp[20],ch;
FILE *fp,*fp1;

void shuru()
{
if((fp=fopen("s_score.txt","ab+"))==NULL)
{
printf("cannot open this file.\n");
getch();exit(0);
}
for(i=0;i<=1000;i++)
{
printf("\nPlease shuru xuehao:");
gets(data.xuehao);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score[2]=atof(temp);
printf("Please shuru wuli score:");
gets(temp);data.score[3]=atof(temp);
printf("Please shur huaxue score:");
gets(temp);data.score[4]=atof(temp);
data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];
fwrite(&data,sizeof(data),1,fp);
printf("another?y/n");
ch=getch();
if(ch=='n'||ch=='N')
break;
} fclose(fp);
}
void xianshi()
{
float s;int n;
if((fp=fopen("s_score.txt","rb+"))==NULL)
{
printf("Cannot reading this file.\n");
exit(0);
}
for(i=0;i<=1000;i++)
{
if((fread(&info[i],sizeof(info[i]),1,fp))!=1)
break;
}
printf("\nxuehao mingzi yuwen shuxue yingyu wuli huauxue zhongfen\n");
for(j=0,k=1;j<i;j++,k++)
{
info[j].mingci=k;

printf("%6s %8s %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f\n",info[j].xuehao,info[j].mingzi,info[j].score[0],info[j].score[1],info[j].score[2],info[j].score[3],info[j].score[4],
info[j].score[5]);
}
getch();
fclose(fp);
}

void xiugai()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("Cannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xiugai xuehao:");
scanf("%d",&i); getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{
printf("xuehao:%s\nmingzi:%s\n",data.xuehao,data.mingzi);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score[2]=atof(temp);
printf("Please input wuli score:");
gets(temp);data.score[3]=atof(temp);
printf("Please input huaxue score:");
gets(temp);data.score[4]=atof(temp);
data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];

} fwrite(&data,sizeof(data),1,fp1);
}
fseek(fp,0L,0);
fseek(fp1,0L,0);
while((fread(&data,sizeof(data),1,fp1))==1)
{
fwrite(&data,sizeof(data),1,fp);
}

fclose(fp);
fclose(fp1);
}
void chazhao()
{
if((fp=fopen("s_score.txt","rb"))==NULL)
{
printf("\nCannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xuehao chakan:");
scanf("%d",&i);
while(fread(&data,sizeof(data),1,fp)==1)
{
j=atoi(data.xuehao);
if(i==j)
{
printf("xuehao:%s mingzi:%s\nyuwen:%f\n shuxue:%f\n yingyu:%f\n wuli:%f\n huaxue:%f\n ",data.xuehao,data.mingzi,data.score[0],data.score[1],data.score[2],data.score[3],data.score[4],data.score[5]);
}getch();
}
}
void shanchu()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("\nopen score.txt was failed!");
getch();
exit(0);
}
printf("\nPlease input ID which you want to del:");
scanf("%d",&i);getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{

printf("Anykey will delet it.\n");
getch();
continue;
}
fwrite(&data,sizeof(data),1,fp1);
}
fclose(fp);
fclose(fp1);
remove("s_score.txt");
rename("temp.txt","s_score.txt");
printf("Data delet was succesful!\n");
printf("Anykey will return to main.");
getch();
}
main()
{
while(1)
{
clrscr(); /*清屏幕*/
gotoxy(1,1); /*移动光标*/
textcolor(YELLOW); /*设置文本显示颜色为黄色*/
textbackground(BLUE); /*设置背景颜色为蓝色*/
window(1,1,99,99); /* 制作显示菜单的窗口,大小根据菜单条数设计*/
clrscr();
printf("*************welcome to use student manage******************\n");
printf("*************************menu********************************\n");
printf("* ========================================================= * \n");
printf("* 1>shuru 2>xiugai * \n");
printf("* 3>shanchu 4>chazhao * \n");
printf("* 5>xianshi 6>exit * \n");
printf("* * \n");
printf("* --------------------------------------------------------- * \n");
printf(" Please input which you want(1-6):");
ch=getch();
switch(ch)
{
case '1':shuru();break;
case '2':xiugai(); break;
case '3':shanchu(); break;
case '4':chazhao(); break;
case '5':xianshi(); break;
case '6':exit(0);
default: continue;
}
}
}
你自己修改,在WIN-TC下通过了编译

阅读全文

与tc源码下载相关的资料

热点内容
微信解压游戏怎么下载 浏览:961
忍三服务器不同如何登上账号 浏览:821
php求积 浏览:294
封面命令 浏览:879
手机复制文件夹到另一个文件夹 浏览:992
手游为什么不能统一下服务器 浏览:246
iphone上pdf 浏览:884
window定时python脚本 浏览:64
怎么运行cmd命令行 浏览:366
php中类的继承 浏览:228
openvpnlinux安装配置 浏览:463
PHP7从入门到精通 浏览:27
单片机生日 浏览:500
linux当前进程号 浏览:728
老死pdf 浏览:25
云服务器关机网址不见了 浏览:69
余冠英pdf 浏览:756
开发一个app上市需要什么步骤 浏览:28
phpsleep方法 浏览:430
时间同步服务器ip地址6 浏览:926