#include <stdio.h>int main(){    int max(int a,int b);    int a,b,c;    printf("please input a,b,c:\n");    scanf("%d,%d",&a,&b);    c=max(a,b);    printf("maxnum=%d\n",c);}int max(int a,int b){    if(a>b)        return a;    else        return b;}
    
    
    
    
          #include <stdio.h>void main(){    void swap(int *pt1,int *pt2);    int n1,n2,n3;    int *p1,*p2,*p3;    printf("please input three  n1,n2,n3:\n");    scanf("%d,%d,%d",&n1,&n2,&n3);    p1=&n1;    p2=&n2;    p3=&n3;    if(n1>n2) swap(p1,p2);    if(n1>n3) swap(p1,p3);    if(n...
    
    
    
    
          阅读后,大家不妨做以下几件事情:
1.  对程序进行正确注释
2.画出程序流程图
3.写出程序运行的结果(模拟程序的要求)
 
题目1:用指针方法处理,输入3个整数,按由小到大的顺序输出  
#include <stdio.h>    //库函数说明
void main()   //main函数定义
{
        void swap(int * pt1 , int * pt2);  //自定义函数swap说明
        int n1, n2, n3;   /* 定义3整型变量 */
        int *p1, *p2, *p3; /* 定义3整型指...
    
    
    
    
          #include <stdio.h>#include <malloc.h>typedef struct _type{    int a;    char b;} Type;int main(){    int *p=NULL;    Type q;    q.a = 7;    printf("q=%d\n",q.a);    printf("q.a point=%x\n",&q.a);    p=&(q.a);    printf("p=%x\n",p);    printf("p=%x\n",&p);    printf("p=%d\n",*p);    re...
    
    
    
    
          #include <stdio.h>#include <conio.h>int main(void){    int i,array[10],big;    for(i=0;i<10;i++)        scanf("%d\n",&array[i]);    big=array[0];    for(i=1;i<10;i++)        if(array[i]>big)            big=array[i];    printf("the big is%5d\n",big);    getch();}
    
    
    
    
          #include <stdio.h>#include <conio.h>int sum(int x,int y);int main(){int a,b,s;printf("please input:");scanf("%d,%d",&a,&b);s=sum(a,b);getch();return 0;}int sum(int x,int y){ int z; z=x+y; printf("z=%d",z); return z;}
    
    
    
    
          今天写的例子,只贴代码,不使用文字说明.mysqltool.h
#include <stdio.h>#include <stdlib.h>#include <winsock.h>#include <mysql.h>int xinsert(MYSQL *mysql,char *strsql){         int t;      MYSQL_RES *res;     t=mysql_real_query(mysql,strsql,(unsigned int)strlen(strsql));     if(t){           printf( "Error id=%d  E...
    
    
    
    
          #include <stdlib.h>#include <stdio.h>#include <WinSock.h>#include <Windows.h>#include <mysql.h>
#pragma comment(lib, "libmysql.lib")
int main(){      MYSQL mysql;     //mysql连接       MYSQL_RES *res; //这个结构代表返回行的一个查询结果集       MYSQL_ROW row; //一个行数据的类型安全(type-safe)的表示      char *query;  //查询语句   ...
    
    
    
    
          备注:开发环境是Microsoft Visual Studio 2010+mysql(绿色版)
 
首先说下,Microsoft Visual Studio 2010如何建立C语言工程。
文件----新建-----项目-----Visual C++-------WIN32-------WIN32控制台应用程序
接下来就输入项目名称HelloWOrld,点击确定按钮,到这里项目建立完成。
 
建立C语言mysql.c文件的步骤是:点击HelloWOrld的右键-------添加---------新建项-----然后名称写的时候要注意一下,名称写完的时候,后面一定要加上.c,否则...
    
    
    
    
          
C的设计原则是把函数作为程序的构成模块。main()函数称之为主函数,一个C程序总是从main()函数开始执行的。
一、main()函数的形式
在最新的 C99 标准中,只有以下两种定义方式是正确的:
int main( void )--无参数形式
{
...
return 0;
}
int main( int argc, char *argv[] )--带参数形式
{
...
return 0;
}
int指明了main()函数的返回类型,函数名后面的圆括号一般包含传递给函数的信息。void表示没有给函数传递参数。关于带参数的形式,我们等会讨论。
浏览老...
    
    
    
    
          #include<stdio.h>int swap2(int *p1,int *p2){ int t; t=*p1; *p1=*p2; *p2=t;}void main(){ int a=10,b=9; swap2(&a,&b);    printf("%d,%d\n",a,b);}