當前位置:首頁 » 編程語言 » c語言圖形字母

c語言圖形字母

發布時間: 2023-07-29 02:03:03

c語言:輸入行數n,及首個小寫字母,輸出Z型字母圖形,如果輸出超過z,再回到a,依次循環下去

代碼文本:

#include "stdio.h"

int main(int argc,char *argv[]){

char ch,n,i,j,t;

printf("Input line number and a letter... ");

if(scanf("%d %c",&n,&ch)!=2 || ch<'a' || ch>'z'){

printf("Input error, exit... ");

return 0;

}

for(ch-='b',i=0;i<n;i++)

putchar((++ch%=26)+'a');

putchar(' ');

for(t=n-2,i=0;i<t;i++){

for(j=0;j<t-i;putchar(' '),j++);

putchar((++ch%=26)+'a');

putchar(' ');

}

for(i=0;i<n;i++)

putchar((++ch%=26)+'a');

putchar(' ');

return 0;

}

㈡ 如何用c語言列印x型的字元圖形急求!!!!

#include<stdio.h>
#include<time.h>

chararr[1000];

voidoutput(intn,charch){

intcount=0;
inttot=2*(n-1)+1;
inti,j;
while(count!=tot){

if(ch>'Z')
ch='A';
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'){
ch++;
continue;
}
arr[++count]=ch++;
}

for(i=n;i>=1;--i){

for(j=0;j<n-i;++j)
printf("");
if(n-i+1==tot-n+i){
printf("%c ",arr[n-i+1]);
continue;
}
printf("%c",arr[n-i+1]);
for(j=0;j<2*(i-1)-1;++j)
printf("");
printf("%c",arr[tot-n+i]);
printf(" ");

}
for(i=2;i<=n;++i){

for(j=0;j<n-i;++j)
printf("");
printf("%c",arr[n-i+1]);
for(j=0;j<2*(i-1)-1;++j)
printf("");
printf("%c",arr[tot-n+i]);
printf(" ");
}

}
intmain(){

inti;
charch;
scanf("%d%c",&i,&ch);
output(i,ch);
return0;

}

昨天幫一個人寫的 不知道你們是不是一個學校的

㈢ C語言編程 輸入數字和大寫字母,輸出由字母組成的Z圖形.

根據題意,需要輸入字元c,和數字n,然後輸出由c組成的n*n大小的Z形圖案,即:

1 輸出n個c;

2 輸出n-2行,逐行遞減形成/;

3 輸出n個c;

代碼如下:

intmain()
{
charc;
intn;
inti,j;
scanf("%d,%c",&n,&c);
for(i=0;i<n;i++)putchar(c);
putchar(' ');
for(i=1;i<n-1;i++)
{
for(j=0;j<n-i;j++)
putchar('');
putchar(c);
putchar(' ');
}
for(i=0;i<n;i++)putchar(c);
putchar(' ');
}
熱點內容
nsftp速度 發布:2025-02-07 10:30:58 瀏覽:430
存儲過程ifor 發布:2025-02-07 10:25:28 瀏覽:432
命令行執行oracle腳本文件命令行 發布:2025-02-07 10:14:49 瀏覽:95
ibook安卓怎麼下 發布:2025-02-07 10:12:13 瀏覽:692
銀行卡沒有密碼怎麼辦啊 發布:2025-02-07 10:08:13 瀏覽:30
游戲庫源碼 發布:2025-02-07 09:49:15 瀏覽:53
享宇錢包上傳不了照片 發布:2025-02-07 09:48:32 瀏覽:632
模擬器怎麼開安卓版本 發布:2025-02-07 09:42:35 瀏覽:771
c程序設計語言源碼 發布:2025-02-07 09:22:41 瀏覽:624
資料庫域的概念 發布:2025-02-07 09:22:40 瀏覽:640