1. 程式人生 > 實用技巧 >laravel框架實現去掉URL中index.php的方法

laravel框架實現去掉URL中index.php的方法

實驗任務1

#include<math.h>
#include<stdio.h>
int main()
    {
    float a,b,c,x1,x2;
    float delta,real,imag;
    printf("Enter a,b,c:");
    while(scanf("%f%f%f",&a,&b,&c)!= EOF)
    {
        if(a==0)
        printf("not quadratic equation.\n\n");
        else 
        {
            delta
=b*b-4*a*c; if(delta>=0) { x1=(-b+sqrt(delta))/(2*a); x2=(-b-sqrt(delta))/(2*a); printf("x1=%.2f,x2=%.2f\n\n",x1,x2); } else { real=-b/(2*a); imag=sqrt(-delta)/(2*a); printf(
"x1=%.2f+%.2fi,x2=%.2f-%.2fi\n\n",real,imag,real,imag); } } printf("Enter a,b,c:"); } return 0; }

實驗任務2

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define N 5
int main(){
    int x, n;
    srand(time(0));
    n = 0;
    
do { n++; x = rand()%10; printf("%3d",x); }while(n<N); printf("\n"); return 0; }

實驗任務3

#include<stdio.h>
#include<math.h>
int isprime(int);
int main(){
    int i= 0,t=0;
    for(i=101;i<=200;i++)
    {
        if(isprime(i))
        {
        t++;
        printf("%d\t",i);
        
        if(t%5==0)
        printf("\n"); 
    }
    }
        printf("\n101~200之間共有%d個素數.",t);
    return 0;
} 
    int isprime(int n)
    { 
    if(n<2)
    return 0;
      int k;
    for(k=2;k<=sqrt(n);k++)
    {
    
    if(n%k==0)
    return 0;
    
    }
    return 1;
}

實驗任務4

#include<stdio.h>
#include<math.h>
int main(){
    long m,n,s,t;
    printf("Enter a number:");
    while(scanf("%d",&s)!=EOF)
    {
        t=0;n=0;
        while(s>0)
        {
            m=s%10;
            s=(s-m)/10;
            if(m%2!=0)
            {
                n++;
                t=t+m*pow(10,n-1);
        }
            }
            printf("new number is:%d\n",t);
            printf("\nEnter a number:");
        
    }
    return 0;
} 

實驗任務5

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    float s,sum;
    int n,i;
    printf("Enter n(1~10):");
    while(scanf("%d",&n)!=EOF)
    {
        sum=0.0,s=1.0;
        for(i=1;i<=n;++i)
        {
            s=s*i;
            sum=sum+pow(-1,i-1.0)/s;
        }
        printf("n=%d,sum=%lf\n",n,sum);
        printf("\nEnter n(1~10):");
    }
    return 0;
 } 

實驗任務6

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(){
    int x,y=1,z;
    printf("猜猜2020年12月哪一天會是你的lucky day\n");
    printf("開始嘍,你有三次機會,開始猜吧(1~31):");
    srand(time(0));
    z=rand()%32;
    scanf("%d",&x);
    while(y<3){
        if(x==z)
        {
            printf("\n猜中啦!你的lucky day是%d號",z);
            break;
        }
        else if(x<z)
        {
            printf("\n你猜的日期早了,lucky day還在後面呢\n");
            y++;
        }
        else if(x>z)
    {
        printf("\n你猜的日期晚了,lucky day悄悄溜到前面啦\n");
        y++;
    }
    printf("\n再猜(1~31):");
    scanf("%d",&x);
    
    }
    if(y=3){
        printf("\n次數用完啦,偷偷告訴你,12月,你的lucky day是%d號\n",z);
    }
    return 0;

}