标签:not jin putc parameter function code The gap lang
#include <stdio.h>
#include <string.h>
#define NAME "ENOMOTHEM, INC."
#define ADDRESS "101 Beijing China"
#define PLACE "Megapolis, CA 00000"
#define WIDTH 40
#define WJXNUM 40
#define SPACE ' '
// function protype
void show_n_char(char ch, int num);
int main(void)
{
int spaces;
// function call
show_n_char('A',WJXNUM);
printf("\n");
putchar('\n');
show_n_char('*', WIDTH);
putchar('\n');
show_n_char(SPACE, 12);
printf("%s\n", NAME);
spaces = (WIDTH - strlen(ADDRESS)) / 2;
show_n_char(SPACE, spaces);
printf("%s\n", ADDRESS);
show_n_char(SPACE, (WIDTH - strlen(PLACE)) / 2);
printf("%s\n", PLACE);
show_n_char('*', WIDTH);
putchar('\n');
return 0;
}
//function definition
void show_n_char (char ch, int num)
{
int count;
for (count = 1; count <= num; count++)
putchar(ch);
}
标签:not jin putc parameter function code The gap lang
原文地址:https://www.cnblogs.com/enomothem/p/11704721.html