编程语言
首页 > 编程语言> > c primer plus 12 编程练习

c primer plus 12 编程练习

作者:互联网

 

1、

#include <stdio.h>

void critic(int * ar1);

int main(void)
{
    int num;
    
    printf("how many pounds to a firkin of butter? \n");
    scanf("%d", &num);
    
    while(num != 56)
        critic(&num);
    
    printf("you must have looked the answer!\n");
    
    return 0;
}

void critic(int * ar1)
{
    printf("wrong, try again!\n");
    scanf("%d", ar1);
}

 

#include <stdio.h>

void critic(int * n);

int main(void)
{
    int units;
    
    printf("how many pounds to a firkin of butter?\n");
    scanf("%d", &units);
    
    while(units != 56)
        critic(&units);
        
    printf("you must have looked it up!\n");
    
    return 0;    
} 

void critic(int * n)
{
    printf("No luck, my friends, try again.\n");
    scanf("%d", n);
}

 

标签:12,int,void,critic,num,plus,printf,primer,scanf
来源: https://www.cnblogs.com/liujiaxin2018/p/15358353.html