吴福林吧 关注:64贴子:6,443
#include<stdio.h>
int main ()
{
int x=10,y=12;
int t;
printf("x=%d y=%d\n",x,y);
t=x;
x=y;
y=t;
printf("x=%d y=%d\n",x,y);
return(0);
}


IP属地:福建来自Android客户端1楼2016-03-03 16:48回复
    #include<stdio.h>
    int main()
    {
    float m,n,s;
    float min(float a,float b);
    printf("input m,n:");
    scanf("%d,%d",&m,&n);
    s=min(m,n);
    printf("The min is:%d\n",s);
    return 0;
    }
    float min(float a,float b)
    {
    float c;
    if(a>b)
    c=b;
    else
    c=a;
    return c;
    }


    IP属地:福建2楼2016-03-03 17:26
    回复
      2025-05-29 11:53:25
      广告
      #include<stdio.h>
      int main()
      {
      float m,n,s;
      float max(float a,float b);
      printf("input m,n:");
      scanf("%d,%d",&m,&n);
      s=max(m,n);
      printf("The max is:%d\n",s);
      return 0;
      }
      float max(float a,float b)
      {
      float c;
      if(a>b)
      c=b;
      else
      c=a;
      return c;
      }


      IP属地:福建3楼2016-03-03 17:36
      回复
        #include<stdio.h>
        int main()
        {
        float m,n,s;
        float max(float a,float b);
        printf("input m,n:");
        scanf("%f,%f",&m,&n);
        s=max(m,n);
        printf("The max is:%f\n",s);
        return 0;
        }
        float max(float a,float b)
        {
        float c;
        if(a>b)
        c=b;
        else
        c=a;
        return c;
        }


        IP属地:福建4楼2016-03-03 17:39
        回复
          #include<stdio.h>
          void main()
          {
          char c;
          printf("请输入一个小写字母");
          scanf("%c",&c);
          while(1)
          {
          if('a'<=c&&'z'>=c)
          {
          printf("变换后为:%c\n",c-31);
          return;
          }
          else
          {
          printf("请正确输入小写字母");
          scanf("%c",&c);
          }
          }
          }


          IP属地:福建5楼2016-03-09 09:36
          回复
            #include<stdio.h>
            main()
            {char ch;
            ch=getchar();
            ch=ch-31;
            putchar(ch);
            }


            IP属地:福建6楼2016-03-09 09:58
            回复
              #include<stdio.h>
              #include<math.h>
              void main()
              {float x,y;
              printf("please input a number x:\n");
              scanf("%f",&x);
              if(x>=-2&&x<=-1) y=sqrt(0.25-(x+1.5)*(x+1.5));
              if(x>=-1&&x<0) y=-x-1;
              if(x>=0&&x<=1) y=-x+1;
              if(x>=1&&x<=2) y=-sqrt(0.25-(x-1.5)*(x-1.5));
              printf("%.2f\n",y);
              }


              IP属地:福建来自Android客户端7楼2016-03-17 16:42
              回复
                #include<stdio.h>
                #include<math.h>
                void main()
                {int c,s; float w,p,f,d;
                printf("please input s,w,p:\n");
                scanf("%d%f%f",&s,w,p);
                if (s>=3000)
                c=12;
                else
                c=s/250;
                switch(c)
                {
                case 0:d=0;break;
                case 1:d=2;break;
                case 2:
                case 3:
                case 4:d=5;break;
                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                case 10:
                case 11:d=10;break;
                case 12:d=15;break;
                }
                f=p*w*s*(1-d/100);
                printf("%10.2f\n",f);
                }


                IP属地:福建8楼2016-03-17 17:49
                回复
                  2025-05-29 11:47:25
                  广告
                  #include<stdio.h>
                  #include<conio.h>
                  #include<string.h>
                  int main()
                  {
                  char a1[20],a2[20],b[20];
                  int i,m,flag1,flag2;
                  int j=0;
                  char user[20]={"abc"};
                  char password[20]={"123"};
                  for(i=0;i<3;)
                  {
                  printf("user:");
                  gets(a1);
                  strlwr(a1);
                  for(m=0;m<20;m++)
                  {
                  if(a1[m]!=' ')
                  {
                  a2[j]=a1[m];
                  j++;
                  }
                  }
                  a2[j]='\0';
                  flag1=strcmp(user,a2);
                  if (flag1==0)
                  {
                  printf("password:");
                  while ((b[j++]=getch())!='\r')
                  printf("*");
                  b[j-1]='\0';
                  flag2=strcmp(password,b);
                  if(flag2==0)
                  {
                  printf("\n欢迎使用计算机!\n");
                  break;
                  }
                  else printf("\n密码错误\n");
                  }
                  else printf("用户名不存在\n");
                  if (i==2) printf("计算机已锁定,将无法使用!\n");
                  i++;
                  }
                  return 0;
                  }


                  IP属地:福建来自Android客户端9楼2016-03-23 08:59
                  回复
                    #include<stdio.h>
                    #include<string.h>
                    void main()
                    {
                    int i,flag1,flag2;
                    char name[20]="lushan",password[10]="123456";
                    char person[20],password1[10];
                    for(i=0;i!=3;)
                    {
                    printf("Please input the name:\n");
                    gets(person);
                    flag1=strcmp(person,name);
                    printf("Please input the password:\n");
                    gets(password1);
                    flag2=strcmp(password,password1);
                    if(flag1==0&&flag2==0)
                    {
                    printf("Pass successfully!");
                    break;
                    }
                    else
                    {
                    printf("You have enter the wrong name or password!\n");
                    i++;
                    }
                    }
                    }


                    IP属地:福建来自Android客户端10楼2016-03-23 09:06
                    回复
                      #include<stdio.h>
                      #include<string.h>
                      void main()
                      {
                      int i,flag1,flag2;
                      char name[20]="1",password[10]="2";
                      char person[20],password1[10];
                      for(i=0;i!=2;)
                      {
                      printf("Please input your id:\n");
                      gets(person);
                      flag1=strcmp(person,name);
                      printf("Please input your password:\n");
                      gets(password1);
                      flag2=strcmp(password,password1);
                      if(flag1==0&&flag2==0)
                      {
                      printf("Pass successfully!");
                      break;
                      }
                      else
                      {
                      printf("Account Suspended!\n");
                      i++;
                      }
                      }
                      }


                      IP属地:福建11楼2016-03-23 09:11
                      回复
                        #include <stdio.h>
                        #include <string.h>
                        void main()
                        {
                        int i=0;
                        while(i<3)
                        {
                        printf( "输入用户名:");
                        char name[10],psw[10];
                        scanf("%s",name);
                        printf("输入密码:");
                        scanf("%s",psw);
                        if((strcmp(name,"abc")==0)&&(strcmp(psw,"123456"))==0)
                        {
                        printf("welcome to use the software\n");
                        break;
                        }
                        i++;
                        }
                        if(i>=3)
                        {
                        printf("password error!you can not use software\n");
                        }
                        }


                        IP属地:福建来自Android客户端12楼2016-03-23 09:16
                        回复
                          #include <stdio.h>;
                          #include <stdlib.h>;
                          main(){
                          int key,i;
                          printf("请输入密码:\n");
                          scanf("%d",&key);
                          if(key==123)
                          printf("welcome to use the software!\n");
                          else{
                          printf("请输入密码:");
                          scanf("%d",&key);
                          if(key==123)
                          printf("welcome to use the software!\n");
                          else{
                          printf("请输入密码:");
                          scanf("%d",&key);
                          if(key==123)
                          printf("welcome to use the software!\n");
                          else printf("password error!you can not use software!\n");
                          }
                          }
                          system("pause");
                          }


                          IP属地:福建来自Android客户端13楼2016-03-23 09:19
                          回复
                            #include <stdio.h>;
                            #include <stdlib.h>;
                            main(){
                            int key,i,z;
                            printf("请输入id:\n");
                            scanf("%d",&i);
                            if(i==1)
                            {
                            printf("请输入密码:\n");
                            scanf("%d",&z);
                            if(z==2)
                            printf("welcome to use the software!\n");
                            else
                            printf("请输入密码:\n");
                            scanf("%d",&z);
                            if(z==2)
                            printf("welcome to use the software!\n");
                            else printf("password error!you can not use software!\n");
                            }
                            else
                            printf("请输入id:\n");
                            scanf("%d",&i);
                            if(i==1)
                            {
                            printf("请输入密码:\n");
                            scanf("%d",&z);
                            if(z==2)
                            printf("welcome to use the software!\n");
                            else printf("请输入密码:\n");
                            scanf("%d",&z);
                            if(z==2)
                            printf("welcome to use the software!\n");
                            else printf("password error!you can not use software!\n");
                            }
                            return 0;
                            }


                            IP属地:福建14楼2016-03-23 09:54
                            回复
                              2025-05-29 11:41:25
                              广告
                              #include <stdio.h>;
                              #include <stdlib.h>;
                              main(){
                              int key,i,z;
                              printf("please input your id:\n");
                              scanf("%d",&i);
                              if(i==1)
                              {
                              printf("please input your password:\n");
                              scanf("%d",&z);
                              if(z==2)
                              printf("welcome to use the software!\n");
                              else
                              printf("please input your password:\n");
                              scanf("%d",&z);
                              if(z==2)
                              printf("welcome to use the software!\n");
                              else printf("account suspended!\n");
                              }
                              else
                              printf("please input your id:\n");
                              scanf("%d",&i);
                              if(i==1)
                              {
                              printf("please input your password::\n");
                              scanf("%d",&z);
                              if(z==2)
                              printf("welcome to use the software!\n");
                              else printf("please input your password::\n");
                              scanf("%d",&z);
                              if(z==2)
                              printf("welcome to use the software!\n");
                              else printf("account suspended!\n");
                              }
                              return 0;
                              }


                              IP属地:福建15楼2016-03-23 09:59
                              回复