c语言高手帮帮忙!!谢谢!! 实训题3:编写程序,编写一个函数输出如下图形, 10
组成图形的符号通过参数指定,图形的行数由参数确定,主函数中输入行数n和字符c,然后调用函数输出图形。设函数定义是:voiddraw(n,c)如,输入5A,则输出如下图形:...
组成图形的符号通过参数指定,图形的行数由参数确定,主函数中输入行数n和字符c,然后调用函数输出图形。设函数定义是:
void draw(n, c)
如,输入 5 A,则输出如下图形:
A
AAA
AAAAA
AAAAAAA
AAAAAAAAA
那个图形是个等腰三角形 展开
void draw(n, c)
如,输入 5 A,则输出如下图形:
A
AAA
AAAAA
AAAAAAA
AAAAAAAAA
那个图形是个等腰三角形 展开
展开全部
#include <stdio.h>
void Print(int n)
{
for ( int i = 0; i < n; ++i )
printf("*");
printf("\n");
}
void PrintAngi(int n, int flag)
{
int i;
if ( flag )
for ( i = 0; i <= n; ++i )
Print(i);
else
for ( i = n; i >0; --i )
Print(i);
}
void main()
{
PrintAngi(10,1);
PrintAngi(10,0);
}
void Print(int n)
{
for ( int i = 0; i < n; ++i )
printf("*");
printf("\n");
}
void PrintAngi(int n, int flag)
{
int i;
if ( flag )
for ( i = 0; i <= n; ++i )
Print(i);
else
for ( i = n; i >0; --i )
Print(i);
}
void main()
{
PrintAngi(10,1);
PrintAngi(10,0);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<stdio.h>
void drow(int kongLength,int hangshu,int ch){//三个参陵猛晌数分别为第一行的知团空格数,可以使图形平移,第二个是输出多少行,第三个是输出什么字符
int j,i,charLength;
charLength = 1;
for (j=0; j<hangshu; j++) {
for (i=0; i<kongLength; i++) {
printf(" ");
}
for (i=0; i<charLength; i++) {
printf("尺锋%c",ch);
}
charLength += 2;
kongLength--;
printf("\n");
}
}
main()
{
int hangshu,kongLength;
char ch;
ch=getchar();scanf("%d %d",&hangshu,&kongLength);
drow(kongLength,hangshu,ch);
getch();
}
输入
V
15 20
输出
V
VVV
VVVVV
VVVVVVV
VVVVVVVVV
VVVVVVVVVVV
VVVVVVVVVVVVV
VVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVVVVVVVVVV
void drow(int kongLength,int hangshu,int ch){//三个参陵猛晌数分别为第一行的知团空格数,可以使图形平移,第二个是输出多少行,第三个是输出什么字符
int j,i,charLength;
charLength = 1;
for (j=0; j<hangshu; j++) {
for (i=0; i<kongLength; i++) {
printf(" ");
}
for (i=0; i<charLength; i++) {
printf("尺锋%c",ch);
}
charLength += 2;
kongLength--;
printf("\n");
}
}
main()
{
int hangshu,kongLength;
char ch;
ch=getchar();scanf("%d %d",&hangshu,&kongLength);
drow(kongLength,hangshu,ch);
getch();
}
输入
V
15 20
输出
V
VVV
VVVVV
VVVVVVV
VVVVVVVVV
VVVVVVVVVVV
VVVVVVVVVVVVV
VVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVVVVVVVV
VVVVVVVVVVVVVVVVVVVVVVVVVVVVV
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询