C 不输入my personname函数。这是逻辑正确的方式,我把功能和所有?

C 不输入my personname函数。这是逻辑正确的方式,我把功能和所有?,c,arrays,function,pointers,C,Arrays,Function,Pointers,我不知道为什么它不运行我的personname func。是我的编译器的错还是我的代码。如果我想把指针放在哪里呢。还有,是否可以将指针var从一个主func传递到另一个func #include <stdio.h> #include <stdlib.h> void personname(int, char ); float totalprice1(int, float, float); int main() { float total1, ticketpric

我不知道为什么它不运行我的personname func。是我的编译器的错还是我的代码。如果我想把指针放在哪里呢。还有,是否可以将指针var从一个主func传递到另一个func

#include <stdio.h>
#include <stdlib.h>

void personname(int, char );
float totalprice1(int, float, float);

int main()
{
    float total1, ticketprice,alacarteprice, price, combo_price=0, 
    drink_price=0, popcorn_price=0, snacks_price=0, comboset=0, 
    totalprice=0;
    int  pay, snacks, popcorn, beverage, order, set, menu, food, i,booking, 
    time, movie, people=0, number=0, quantity=0, qtyBev=0, qtyPopcorn=0, 
    qtySnacks=0, alacarte=0;
    char date[50], people1[100][100];

    printf ("Choose your movie (1=BabyBoss   2=GuardiansOFTheGalaxy  
    3=Fast&Furious8   4=ShockWave  5=BeautyandTheBeast  6=GetOut): ");
    scanf ("%d",&movie);

    puts ("Enter your date: ");
    scanf ("%s",&date);

    if (movie==1)
   {
       printf ("Choose Showing Time ( 1=9:00 a.m , 2=3:15 p.m, 3=5:00 p.m, 
       4=8:30 p.m): ");
       scanf ("%d",&time);

       switch (time)
    {
        case 1: price=12;
        break;

        case 2: price=12;
        break;

        case 3: price=14;
        break;

        default: printf ("Wrong input");
    }
}
else
if (movie==2)
{
    printf ("Choose Showing Time (1=12:00 p.m , 2=3:30 p.m , 3=8:00 p.m , 
    4=10:30 p.m): ");
    scanf ("%d",&time);

    switch (time)
    {
        case 1: price=15;
        break;

        case 2: price=15;
        break;

        case 3: price=17;
        break;

        case 4: price=17;
        break;

        default: printf ("Wrong input");
    }
}
else
if (movie==3)
{
    printf ("Choose Showing Time (1=2:00 p.m, 2=5:00 p.m , 3=8:00 p.m , 
    4=10:30 p.m): ");
    scanf ("%d",&time);

    switch (time)
    {
        case 1: price=16;
        break;

        case 2: price=16;
        break;

        case 3: price=18;
        break;

        case 4: price=18;
        break;

        default: printf ("Wrong input");
    }
}
else
if (movie==4)
{
    printf ("Choose Showing Time (1=2:00 p.m , 2=5:00 p.m , 3=8:00 p.m, 
    4=10:30 p.m): ");
    scanf ("%d",&time);

    switch (time)
    {
        case 1: price=16;
        break;

        case 2: price=16;
        break;

        case 3: price=18;
        break;

        case 4: price=18;
        break;

        default: printf ("Wrong input");
    }
}
else
if (movie==4)
{
    printf ("Choose Showing Time (1=2:00 p.m , 2=5:00 p.m , 3=8:00 p.m, 
    4=10:30 p.m): ");
    scanf ("%d",&time);

    switch (time)
    {
        case 1: price=16;
        break;

        case 2: price=16;
        break;

        case 3: price=18;
        break;

        case 4: price=18;
        break;

        default: printf ("Wrong input");
    }
}
else
if (movie==5)
{
    printf ("Choose Showing Time (1=11:00 a.m, 2=1:00 p.m , 3=3:30 p.m , 
    4=5:30 p.m , 5=9:30 p.m): ");
    scanf ("%d",&time);

    switch (time)
    {
        case 1: price=16;
        break;

        case 2: price=16;
        break;

        case 3: price=16;
        break;

        case 4: price=18;
        break;

        case 5: price=18;
        break;

        default: printf ("Wrong input");
    }

}
else
{
    printf ("Choose Showing Time ( 1=10:00 a.m, 2=1:00 p.m , 3=4:30 p.m , 
    4=6:00 p.m): ");
    scanf ("%d",&time);

    switch (time)
    {
        case 1: price=12;
        break;

        case 2: price=12;
        break;

        case 3: price=12;
        break;

        case 4: price=12;
        break;

        default: printf ("Wrong input");
    }

}

printf ("Do you want to proceed your bookings? (1 for Yes, 0 for No): ");
scanf ("%d",&booking);

if (booking==1)
{
    puts ("Enter number of person: ");
    scanf ("%d",&number);

    for (i=0;i<number; i++)
    {
        printf ("Enter your name: ");
        scanf ("%s",&people1[i]);
    }
}


printf ("\nTotal number of person: %d\n",number);


for (i=0; i<number; i++)
{
    personname (i, people1[i]);
}

printf ("\nDo you want to add-on cinema food? (1 for Yes, 0 for No): ");
scanf ("%d",&food);

if (food==1)
{
    do
    {
        printf ("Order Menu( 1=Combo set, 2=Alacarte, 3=cancel order food) : 
");
        scanf ("%d",&menu);

        if (menu==1)
        {
            printf (" Choose Your Choice (1=SetA[ 1caramel popcorn (S) + 1 
 softdrink (S) , 2=SetB [1 caramel popcorn(R) + 1 softdrink (R) , 3=SetC[1 
 caramel popcorn (L) + 2 softdrinks (R)):");
            scanf ("%d",&set);

            switch (set)
            {
                case 1: combo_price=7.8;
                break;

                case 2: combo_price=8.9;
                break;

                default: combo_price=11.9;
                break;
            }

            printf ("Quantity?:");
            scanf ("%d",&quantity);

            comboset=combo_price*quantity;
        }
        else
        if (menu==2)
        {
            printf ("Alacarte ( 1=Beverages,2=Popcorn, 3=Snacks)");
            scanf ("%d",&alacarte);

            if (alacarte==1)
            {
                printf (" Beverages(1=Softdrink, 2=Milo, 3=Nescafe, 
 4=Tropicana Juice): ");
                scanf ("%d",&beverage);

                switch (beverage)
                {
                    case 1: drink_price=3.6;
                    break;

                    case 2: drink_price=4.8;
                    break;

                    case 3: drink_price=3.4;
                    break;

                    default: drink_price=5.2;
                    break;
                }

                printf ("Quantity?: ");
                scanf ("%d",&qtyBev);
            }
            else
            if (alacarte==2)
            {
                printf ("Popcorn(1=Popcorn Caramel, 2=Lite 'N' Sweet, 
3=Salty): ");
                scanf ("%d",&popcorn);

                switch (popcorn)
                {
                    case 1: popcorn_price=5.2;
                    break;

                    case 2: popcorn_price=4.3;
                    break;

                    default: popcorn_price=4.7;
                    break;
                }

                printf ("Quantity?: ");
                scanf ("%d",&qtyPopcorn);
            }
        }
        else
            {
                printf ("Snacks (1=Chicken Nugget(6pcs), 2=Mashed potato, 
3=Curry puff(2pcs), 4=Kit-Kat): ");
                scanf ("%d",&snacks);

                switch (snacks)
                {
                    case 1: snacks=6.4;
                    break;

                    case 2: snacks=2.5;
                    break;

                    case 3: snacks=3.2;
                    break;

                    default: snacks=2.5;
                    break;
                }

                printf ("Quantity?: ");
                scanf ("%d",&qtySnacks);
            }

    alacarteprice=(drink_price*qtyBev)+(popcorn_price*qtyPopcorn)+
(snacks_price*qtySnacks);

    totalprice=comboset+alacarteprice;

    printf ("Are you done ordering food? (1 for Yes, 0 for No) : ");
    scanf ("%d",&order);

    }

    while (order==0);
}

ticketprice=price*number;

printf ("Do you want to make a payment?(1 for Yes, 0 for No) :");
scanf ("%d",&pay);

total1=totalprice1(pay, ticketprice, totalprice);

if (pay==1)
{
    printf ("Ticket Price: RM%.2f\n",ticketprice);
    printf ("Combo Set Price: RM%.2f\n",comboset);
    printf ("Alacarte Price: RM%.2f\n",alacarteprice);
}
else
{
    printf ("Order candelled\n");
    printf ("Ticket Price: RM0.00\n");
    printf ("Combo Set Price: RM0.00\n");
    printf ("Alacarte Price: RM0.00\n");
}

printf ("Total Price: %.2f",total1);

printf ("THANK YOU FOR CHOOSING OUR CINEMA >_< ");

return 0;
}

void personname(int a, char b)
   {
printf ("\nPerson %d: %s",a+1, b);
}

float totalprice1(int a, float b, float c)
{
float total;
total=b+c;

return total;
}
#包括
#包括
void personname(int,char);
浮动总价1(整数、浮动、浮动);
int main()
{
float total1,ticketprice,alacarteprice,price,combo_price=0,
饮料价格=0,爆米花价格=0,零食价格=0,套餐价格=0,
总价=0;
国际支付、零食、爆米花、饮料、订单、套餐、菜单、食品、i、预订、,
时间,电影,人物=0,数字=0,数量=0,数量=0,数量=0,数量=0,数量=0,
qtysnaks=0,alacarte=0;
char date[50],people1[100][100];
printf(“选择你的电影(1=BabyBoss 2=galaxy的守护者
3=快速和狂暴8 4=冲击波5=美丽和最后6=逃出);
scanf(“%d”和电影);
放入(“输入您的日期:”);
scanf(“%s”和日期);
如果(电影==1)
{
printf(“选择显示时间(1=上午9:00,2=下午3:15,3=下午5:00,
下午四时三十分);
扫描频率(“%d”和时间);
开关(时间)
{
案例1:价格=12;
打破
案例2:价格=12;
打破
案例3:价格=14;
打破
默认值:printf(“错误输入”);
}
}
其他的
如果(电影==2)
{
printf(“选择显示时间(1=12:00 p.m,2=3:30 p.m,3=8:00 p.m,
下午四时三十分);
扫描频率(“%d”和时间);
开关(时间)
{
案例1:价格=15;
打破
案例2:价格=15;
打破
案例3:价格=17;
打破
案例4:价格=17;
打破
默认值:printf(“错误输入”);
}
}
其他的
如果(电影==3)
{
printf(“选择显示时间(1=2:00 p.m,2=5:00 p.m,3=8:00 p.m,
下午四时三十分);
扫描频率(“%d”和时间);
开关(时间)
{
案例1:价格=16;
打破
案例2:价格=16;
打破
案例3:价格=18;
打破
案例4:价格=18;
打破
默认值:printf(“错误输入”);
}
}
其他的
如果(电影==4)
{
printf(“选择显示时间(1=2:00 p.m,2=5:00 p.m,3=8:00 p.m,
下午四时三十分);
扫描频率(“%d”和时间);
开关(时间)
{
案例1:价格=16;
打破
案例2:价格=16;
打破
案例3:价格=18;
打破
案例4:价格=18;
打破
默认值:printf(“错误输入”);
}
}
其他的
如果(电影==4)
{
printf(“选择显示时间(1=2:00 p.m,2=5:00 p.m,3=8:00 p.m,
下午四时三十分);
扫描频率(“%d”和时间);
开关(时间)
{
案例1:价格=16;
打破
案例2:价格=16;
打破
案例3:价格=18;
打破
案例4:价格=18;
打破
默认值:printf(“错误输入”);
}
}
其他的
如果(电影==5)
{
printf(“选择显示时间(1=上午11:00,2=下午1:00,3=下午3:30,
下午四时三十分,五时三十分);
扫描频率(“%d”和时间);
开关(时间)
{
案例1:价格=16;
打破
案例2:价格=16;
打破
案例3:价格=16;
打破
案例4:价格=18;
打破
案例5:价格=18;
打破
默认值:printf(“错误输入”);
}
}
其他的
{
printf(“选择显示时间(1=上午10:00,2=下午1:00,3=下午4:30,
下午四时(下午六时);
扫描频率(“%d”和时间);
开关(时间)
{
案例1:价格=12;
打破
案例2:价格=12;
打破
案例3:价格=12;
打破
案例4:价格=12;
打破
默认值:printf(“错误输入”);
}
}
printf(“您想继续预订吗?(1表示是,0表示否):”;
scanf(“%d”和预订);
如果(预订==1)
{
放入(“输入人数:”);
scanf(“%d”和编号);

对于(i=0;i如果要使用函数personname打印名称,第二个参数必须是char*或char[],而不是char

例如:

void personname(int a, char *b)
{
    printf ("\nPerson %d: %s",a+1, b);
}

如果要使用函数personname打印名称,第二个参数必须是char*或char[],而不是char

例如:

void personname(int a, char *b)
{
    printf ("\nPerson %d: %s",a+1, b);
}

是我的编译器的错还是我的编码?……我可以打赌吗?
void personname(int,char);
-->
void personname(int a,char*b);LOL,谢谢@LPs,是我的编译器的错还是我的编码?……我可以打赌吗?
void personname(int,char);
>
void personname(int a,char*b);
LOL,谢谢@LPs,