當前位置:首頁 » 編程語言 » 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(' ');
}
熱點內容
醫美大資料庫 發布:2025-07-03 15:47:07 瀏覽:355
c語言將二進制轉化為十進制 發布:2025-07-03 15:32:47 瀏覽:987
c語言幫助文檔 發布:2025-07-03 15:22:43 瀏覽:319
雙埠存儲器在情況下會發生讀寫沖突 發布:2025-07-03 15:12:54 瀏覽:270
快站資料庫 發布:2025-07-03 14:45:44 瀏覽:39
jsp獲取上傳文件路徑 發布:2025-07-03 14:44:46 瀏覽:569
php時間微妙 發布:2025-07-03 14:39:38 瀏覽:843
巨豆豆手機回復出廠密碼是什麼 發布:2025-07-03 14:35:19 瀏覽:474
演算法的三個 發布:2025-07-03 14:35:19 瀏覽:698
wcf源碼 發布:2025-07-03 14:33:54 瀏覽:863