#include<stdioh>
#include<conioh>
#define N 100
typedef struct stu
{
char num[10];
char name[12];
int age;
float score[2];
float total;
float average;
}STU;
void ptint(STU student[],int n)
{
int i;
puts("All students information:\n");
puts("name num age total average\n");
for(i=0;i<n;i++)
{
printf("%s %s %4d %02f %02f\n",student[i]name,student[i]num,
student[i]age,student[i]total,student[i]average);
}
}
void sort(STU student[],int n)
{
int i,j,imax,k;
STU s;
for(i=0;i<n-1;i++)
{
imax=i;
for(j=i+1;j<n;j++)
{
if(student[imax]total<student[j]total) imax=j;
if(i!=imax)
{
for(k=0;k<12;k++)
sname[k]=student[i]name[k];
for(k=0;k<10;k++)
snum[k]=student[i]num[k];
sage=student[i]age;
sscore[0]=student[i]score[0],sscore[1]=student[i]score[1];
stotal=student[i]total,saverage=student[i]average;
for(k=0;k<12;k++)
student[i]name[k]=student[imax]name[k];
for(k=0;k<10;k++)
student[i]num[k]=student[imax]num[k];
student[i]age=student[imax]age,student[i]score[0]=student[imax]score[0];
student[i]score[1]=student[imax]score[1];
student[i]total=student[imax]total,student[i]average=student[imax]average;
for(k=0;k<12;k++)
student[imax]name[k]=sname[k];
for(k=0;k<10;k++)
student[imax]num[k]=snum[k];
student[imax]age=sage;
student[imax]score[0]=sscore[0],student[imax]score[1]=sscore[1];
student[imax]total=stotal,student[imax]average=saverage;}
}
}
printf("The total score zuigao student:\n");
puts("name num age total average\n");
printf("%-6s %s %4d %02f %02f\n",student[0]name,student[0]num,
student[0]age,student[0]total,student[0]average);
for(i=1;i<n;i++)
if(student[i]total==student[0]total)
{
printf("%-6s %s %4d %02f %02f\n",student[i]name,student[i]num,
student[i]age,student[i]total,student[i]average);
}
ptint(student,n);
}
void count(STU student[],int n)
{
int i;
for(i=0;i<n;i++)
{
student[i]total=student[i]score[0]+student[i]score[1];
student[i]average=(float)student[i]total/2;
printf("The student%d's total score is %02f ",i,student[i]total);
printf("average score is %02f\n",student[i]average);
}
sort(student,n);
}
int main()
{
int i,j,n;
STU stud[N];
printf("Please input students numbers:\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
puts("Please input students'name:");
scanf("%s",&stud[i]name);
puts("Please input students'num:");
scanf("%s",&stud[i]num);
puts("Please input students'age:");
scanf("%d",&stud[i]age);
puts("Please input students'two score:");
for(j=0;j<2;j++)
scanf("%f",&stud[i]score[j]);
}
count(stud,n);
}
fp=fopen("inputtxt", "r");
这一句应该是fp=fopen("C:\\Documents and Settings\\Administrator\\桌面\\inputtxt", "r");
其中“C:\\Documents and Settings\\Administrator\\桌面\\inputtxt”这个写的应该是你inputtxt这个文件的目录,并且‘\’斜线应该写两个,即‘\\’。
pci编程好一点。pci编程可以被编程所读写。TC是一个简单软件开发工具,不需要编程基础就可以快速的开发软件工具,TC带来的是一个人人可开发软件的理念。PCI设备的编程其实和普通设备的编程很相似,没有什么特别不同,主要的不同应该是映射PCI设备的地址空间。
/什么年代了,你还是要turbo c,早就过时了,强烈建议用 vc 60,学C语言,c++最好的编译器,没有之一,vs是开发人员用的。 下面是C语言在VC 下的动态心形图/
#include<stdioh>
#include<mathh>
#include<windowsh>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles
HWND hwndFound; // This is what is returned to the caller
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);//获取控制台标题存入pszOldWindowTitle中
//设置控制台的标题为 时间数 进程ID
wsprintf(pszNewWindowTitle,"%d/%d",//把获取的数目,和当前进程ID输出到缓冲区pszNewwindowtitle中
GetTickCount(),//用于获取 *** 作系统启动后的毫秒数
GetCurrentProcessId());//获取当前进程ID
SetConsoleTitle(pszNewWindowTitle);//更改控制台的标题为新内容
Sleep(40);
hwndFound=FindWindow(NULL, pszNewWindowTitle);//获取控制台的HWND号
SetConsoleTitle(pszOldWindowTitle);//更改控制台的标题为原始内容
return(hwndFound);//返回句柄
}
void drawXY()//绘制X和Y轴
{
HWND hWnd=GetConsoleHwnd();//获取控制台窗口句柄,用于设置画笔颜色
HDC hDC=GetDC(hWnd);
COORD dwSize;//记录窗体大小,用于设定坐标轴远点
HPEN hNewPen=CreatePen(PS_SOLID,1,RGB(255,0,0));//创建画笔对象
HPEN hOldPen=(HPEN)SelectObject(hDC,hNewPen);//选取画笔对象进行绘图
CONSOLE_SCREEN_BUFFER_INFO bInfo; // 窗口信息
HANDLE Hout=GetStdHandle(STD_OUTPUT_HANDLE);//获取控制台句柄
GetConsoleScreenBufferInfo(Hout, &bInfo );//获取控制台信息
dwSize=bInfodwMaximumWindowSize ;//获取窗口大小,此时获得的是字符模式下
//从字符到图像放大坐标轴8倍
dwSizeX =8;
dwSizeY=8;
SetBkMode(hDC, TRANSPARENT);SetTextColor(hDC,255255);
//绘制X轴各个特殊坐标
TextOut(hDC,dwSizeX-15,dwSizeY/2-15,"X",1);
//Arc(hDC,100,100,300,300,350,500,350,500);//画圆 其中hDC表示画图句柄,100,100,300,300表示所使用的矩形区域,350,500表示画弧线的起点,350,500表明画弧线的终点 ;
//绘制Y轴各个特殊坐标
TextOut(hDC,dwSizeX/2,0,"Y",1);
MoveToEx(hDC,0,dwSizeY /2,NULL);
LineTo(hDC,dwSizeX,dwSizeY/2);
MoveToEx(hDC,dwSizeX/2,0,NULL);
LineTo(hDC,dwSizeX/2,dwSizeY);
ReleaseDC(hWnd,hDC);
}
void draw(double p)
{
int i;
double x,y;
HWND hWnd=GetConsoleHwnd();//获取控制台窗口句柄,用于设置画笔颜色
HDC hDC=GetDC(hWnd);
COORD dwSize;//记录窗体大小,用于设定坐标轴远点
HPEN hNewPen=CreatePen(PS_SOLID,1,RGB(255,0,0));//创建画笔对象
HPEN hOldPen=(HPEN)SelectObject(hDC,hNewPen);//选取画笔对象进行绘图
CONSOLE_SCREEN_BUFFER_INFO bInfo; // 窗口信息
HANDLE Hout=GetStdHandle(STD_OUTPUT_HANDLE);//获取控制台句柄
GetConsoleScreenBufferInfo(Hout, &bInfo );//获取控制台信息
dwSize=bInfodwMaximumWindowSize ;//获取窗口大小,此时获得的是字符模式下
//从字符到图像放大坐标轴8倍
dwSizeX =8;
dwSizeY=8;
//MoveToEx(hDC,0,dwSizeY/2,NULL);
for(i=-180;i<=180;i++)
{
x=16pow(sin(i31415926/180),30)p;
y=(13cos(i31415926/180)-5cos(2i31415926/180)-2cos(3i31415926/180)-cos(4i31415926/180))p;
x=(x+16)dwSizeX/32/2+dwSizeX/4;
y=-y/16dwSizeY/23+dwSizeY/2;
x=x;
y=y;
MoveToEx(hDC,x,y,NULL);
LineTo(hDC,x+1,y+1);
}
}
int main()
{
double p;
//drawXY();
for(p=06;p<=1;p=p+001)
draw(p);
system("PAUSE");
}
TC简单程序开发是TC,Thunder C 简写TC,是一款模拟鼠标键盘 *** 作的脚本开发工具,支持中英文编程 TC易学,易懂,易写并且配套有TC教程视频和帮助文档,不需要任何编程知识就可以做出功能强大的TC脚本。
TURBO C是美国Borland公司的产品,Borland公司是一家专门从事软件开发、研制的大公司。Turbo C20不仅是一个快捷、高效的编译程序,同时还有一个易学、易用的集成开发环境。使用Turbo C20无需独立地编辑、编译和连接程序,就能建立并运行C语言程序。曾经是DOS下学习C语言的主要工具。
下载过后,选择里面的SETUP,d出DOS下蓝色安装界面,选择安装路径,比如C:\TC30,选择SETUP,安装完成后,到安装目录,点击TCEXE,就可以使用了,但TC30对CPU的占用相当高,一般都是100%
以上就是关于急求一道C语言编程(TC)全部的内容,包括:急求一道C语言编程(TC)、C语言编程高手请来解决1道tc程序题 要求用input.txt读入数据,output.txt输出、pci编程和tc编程有什么区别等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)