摘要:
#include "stdafx.h"#include <stdio.h>int _tmain(int argc, _TCHAR* argv[]){char *str1[20],*str2[20],*str3[20]; char swap(); printf("please input three strings\n"); scanf("%s",str1); scanf("%s",str2); scanf("%s",str3); printf("%s\n%s\n%s\n&q 阅读全文
摘要:
有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。#define nmax 50 main() { int i,k,m,n,num[nmax],*p; printf("please input the total of numbers:"); scanf("%d",&n); p=num; for(i=0;i<n;i++) *(p+i)=i+1; i=0; k=0; m=0; while(m<n-1) { if(*(p+i)!=0) k++; if(k==3) { *( 阅读全文
摘要:
有五个学生,每个学生有3门课的成绩,从键盘输入以上数据(包括学生号,姓名,三门课成绩),计算出平均成绩,况原有的数据和计算出的平均分数存放在磁盘文件"stud"中.#include "stdio.h" struct student { char num[6]; char name[8]; int score[3]; float avr; } stu[5]; main() {int i,j,sum; FILE *fp; /*input*/ for(i=0;i<5;i++) { printf("\n please input No. %d s 阅读全文
摘要:
1、安装完Visual Studio 2010后打开; 2、“文件>>新建>>项目”(Ctrl+Shift+N); 3、选择“Win32>>Win32控制台应用程序”,输入名称,并确定; 4、选择“下一步>>完成”; 5、此时将会看到如下代码: 1 // HelloNowaMagic.cpp : Defines the entry point for the console application. 2 // 3 4 #include "stdafx.h" 5 6 7 int _tmain(int argc, _TCHAR* 阅读全文