C Primer Plus第二章课后练习答案

其他章节答案

/*Answer of the fourth question */
#include 
void jolly(void); //Note that there are semicolons here!
void deny(void);
int main(void) //Note that there are't semicolons here!
{
    jolly();
    jolly();
    jolly();
    deny();
    return 0;
}
void jolly(void) //the frist function
{
    printf("For he's a jolly good fellow!\n");
}
void deny(void) //the second function
{
    printf("Which nobody can deny!\n");
}
/*Answer of the fifth question */
#include 
void br(void);
void ic(void);
int main(void)
{
    br();
    printf(","); //Pay attention to every trap,it may be a comma or a line break!
    ic();
    printf("\n");
    ic();
    printf(",\n");
    br();
    printf("\n");
    return 0;
}
void br(void)
{
    printf("Brazil,Russia");
}
void ic(void)
{
    printf("India,China");
}
/*Answer of the sixth question */
#include 
int main(void)
{
    int toes,toesD,toes2;
    toes=10;
    toesD=toes*2;
    toes2=toes*toes;
    printf("the toes is %d\n",toes);
    printf("the toes double is %d\n",toesD);
    printf("the toes squared is %d\n",toes2);
    return 0;
}
/*Answer of the seventh question */
#include 
void smile(void);
int main(void)
{
    smile();smile();smile();
    printf("\n");
    smile();smile();
    printf("\n");
    smile();
    printf("\n");
    return 0;
}
void smile(void)
{
    printf("Smile!");
}
/*Answer of the eighth question */
#include 
void one_three(void);
int main(void)
{
    printf("starting now:\n");
    one_three();
    printf("done!\n");
    return 0;
}
void two(void); //声明时应放在定义的前面。
void one_three(void)
{
    printf("one\n");
    two();
    printf("three\n");
}
void two(void)
{
    printf("two\n");
}

你可能感兴趣的:(C Primer Plus第二章课后练习答案)