c语言数组编程,输入一串英文字母,将每个字母改成大写字母并输出 连续输入十个字母,用大写字母写出c语言编程
c\u8bed\u8a00\uff0c\u5c06\u4e00\u4e32\u82f1\u6587\u5b57\u6bcd\u5012\u8fc7\u6765\u8f93\u51fa,\u8be5\u600e\u6837\u5199\u4ee3\u7801\uff1f\u4f8b\u5b50\uff1a\uff08\u6211\u662f\u62ffTC\u5199\u7684\uff0c\u6211\u4eec\u73b0\u5728\u5c31\u5b66\u4e86\u8fd9\u4e2a\u4f60\u81ea\u5df1\u6362\u4ee3\u7801\u5427\u3002\uff09#include#includevoid main(){int b,i,m=0,a=0,n=0;char x[]={"china"};b=strlen(x);for(int i = 0; i<= b; i++){m=m+1; n=i+m; a=i+b-n; printf("%c",x[a]);}}
//vs2013\u7f16\u8bd1\u5668\u4e0b\u8fd0\u884c\uff0c\u5982\u4e0d\u53ef\u6267\u884c\u6dfb\u52a0\u5934\u6587\u4ef6"stdafx.h",\u505a\u5230\u4e86\u4f60\u5728\u8f93\u5165\u975e\u5b57\u6bcd\u7684\u65f6\u5019\uff0c\u5305\u62ec\u6570\u5b57\uff0c\u6807\u70b9\u7b26\u53f7\u7b49\u7684\u8fc7\u6ee4\u3002#include #include #define ALP_LEN 10 //\u4f60\u8981\u4fdd\u7559\u8f6c\u6362\u5b57\u6bcd\u6570\u7684\u957f\u5ea6\uff0c\u4e5f\u5c31\u662f\u6700\u540e\u8f93\u51fa\u622a\u53d6\u957f\u5ea6void alp_upper(){char c;int i = 0;puts("please input 10 alpha:");c = getchar();while(i < ALP_LEN){if(isalpha(c)) //\u63a7\u5236\u5fc5\u987b\u5b57\u6bcd\u8f93\u5165{if(isupper(c)){putchar(c);}else{c = toupper(c);putchar(c);}c = getchar();i++;}else //\u975e\u5b57\u6bcd\u7ee7\u7eed\u5faa\u73af\uff0c\u4e0d\u505a\u8bb0\u5f55{c = getchar();}}}void main(){ alp_upper();}
#include<stdio.h>#include<string.h>
#include<ctype.h>
void main()
{
int i;
char str[80];
printf("input a string:\n");
gets(str);
for(i=0;str[i]!='\0';i++)
str[i] = toupper(str[i]);
printf("%s\n",str);
}
#include<stdio.h>
#include<string.h>
main()
{
char str[50];
int i;
printf("input a string:\n");
gets(str);
for(i=0;str[i]!='\0';i++)
if(str[i]>='a'&&str[i]<='z')
str[i]-=32;
puts(str);
printf("\n");
}
#include"stdio.h"
int main(){
char str[100];
scanf("%s",&str);
int i=0;
while(str[i]!='\0'){
if(str[i]>='a'&&str[i]<='z')
str[i]-=32;
i++;
}
printf("%s\n",str);
return 0;
}
绛旓細include<stdio.h> include<string.h> include<ctype.h> void main(){ int i;char str[80];printf("input a string:\n");gets(str);for(i=0;str[i]!='\0';i++)str[i] = toupper(str[i]);printf("%s\n",str);}
绛旓細include<iostream> include<string> using namespace std;int main(){ char str[50];int n=0;char *p;p=str;cout<<"璇杈撳叆瀛楃涓:"<<endl;cin>>str;for(int i=0;*p!='\0';p++){ if(('a'<=*p && *p<='z') || ('A'<=*p && *p<='Z')){ n++;cout<<*p<<" ";} el...
绛旓細int main(){ char a[100];char b[24];int s[100] = { 0 };//鐢ㄤ簬瀛樺偍瀛楃鐨勪釜鏁 gets(a);//杈撳叆瀛楃 //寮濮嬫瘮杈 for (int x = 0; x < 24; x++){ int c = 0;//璁板綍姣忎釜瀛楃涓暟 b[x] = x + 97;//涓轰簡璁゜[0]鏄痑锛宐[1]鏄痓渚濇绫绘帹 for (int i = 0; i < ...
绛旓細杩欑瘒鏂囩珷涓昏璁茶В濡備綍浣跨敤C璇█缂栫▼锛灏嗙敤鎴杈撳叆鐨勫瓧绗︿覆閫嗗簭瀛樺偍鍦ㄥ師鏁扮粍涓紝骞惰緭鍑虹粨鏋滐紝鏃犻渶璋冪敤鍐呯疆鐨勫瓧绗︿覆澶勭悊鍑芥暟銆備緥濡傦紝褰撴垜浠緭鍏ュ瓧绗︿覆 "hello" 鍜 "world"锛岀▼搴忎細灏嗗畠浠嗗簭鍙樻垚 "dlrow" 鍜 "olleh"銆傚瓧绗︿覆鍦–璇█涓紝鏈川涓婃槸瀛楃鏁扮粍锛屾瘡涓瓧绗﹀崰鐢ㄦ暟缁勭殑涓涓綅缃傚煎緱娉ㄦ剰鐨勬槸锛屽瓧绗...
绛旓細int main(int argc,char *argv[]){char text[300];//瀹氫箟涓涓┖闂磋緝澶х殑char鏁扮粍瀛樻斁杈撳叆鐨則extint i,w;printf("Input a text...\n");fgets(text,300,stdin);//鐢╢gets鏃㈠彲鎺ユ敹绌烘牸鍙堣兘闄愬埗闀垮害w=text[0]>='a' && text[0]<='z' || text[0]>='A' && text[0]<='Z';//...
绛旓細are my only love!";char *p = strtok(s," ");char ss[100][100]; //浠f斁鍏ョ殑浜岀淮鏁扮粍int k = 0;int i;strcpy(ss[k],p);while((p = strtok(NULL," "))!=NULL){strcpy(ss[k],p);k++;}for(i = 0; i <k;i++) //杈撳嚭浜岀淮鏁扮粍puts(ss[i]); return (0); } ...
绛旓細include <stdio.h>char *Months[12] = {"Jan.", "Feb.", "Mar.", "Apr.", "May", "Jun.", "Jul.", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."};int main(){ int mon;scanf("%d", &mon);if (mon >= 1 && mon <= 12) printf("%s\n", Months[mon - 1]);...
绛旓細鎴戞劅瑙変笉鐢ㄥ啀鍒楀惊鐜簡锛坖++锛夛紱鍥犱负鍙鎶婃瘡鍒楃殑绗竴涓瓧绗﹀彉鎴愬ぇ鍐欏氨琛屼簡锛涘彧瑕佹寚鍑篴[i][0],鐒跺悗琛屽惊鐜紙i++锛夊氨琛屼簡锛
绛旓細棣栧厛 鐭ラ亾 ++ 灏辨槸 鍔1 鐨勬剰鎬 鍏舵 a[n]-'a' 绛変簬 0~25锛堝鏋滄槸 a 绛変簬0锛寊 绛変簬25...锛塼imes[a[n]-'a']++; 锛堝鏋滄槸 a锛宼ime[0]++,濡傛灉鏄痾 time[25]++ 鍙互鐢ㄥ叾浠栬鍙ヤ唬鏇匡紝浣嗘槸浼氬鏉備竴鐐癸紝杩欐牱鍐欏緢绠鍗
绛旓細include<stdio.h>#include<string.h>#include<stdlib.h>#define INI20#define INC 10char* input;//鎸囧悜鍔ㄦ鏁扮粍int get_input();//鐢ㄤ簬鎺ユ敹杈撳叆鍊肩殑鍑芥暟锛屼娇鐢ㄥ姩鎬佹暟缁勫彲浠ヤ换鎰杈撳叆锛鏃犲ぇ灏忛檺鍒秜oid ini();//绯荤粺鍒濆鍖朾ool is_exit();//妫娴嬫槸鍚﹂鍑篿nt split();//灏嗗瓧绗︿覆鍒嗚В鍑6浣嶇殑鏁板瓧...