c语言:(用数组与指针法,不使用strupr函数)任意输入一串字符串,将其全部变为大写并反序输出。
C\u8bed\u8a00\u7528strupr\u51fd\u6570\u5c06\u5b57\u7b26\u4e32\u4e2d\u5c0f\u5199\u5b57\u6bcd\u8f6c\u6362\u6210\u5927\u5199\u5b57\u6bcd\uff0c\u5176\u4ed6\u5b57\u7b26\u4e0d\u8f6c\u6362\u3002\u8c22\u8c22\u539f\u578b\uff1aextern char *strupr(char *s);
\u7528\u6cd5\uff1a#include
\u529f\u80fd\uff1a\u5c06\u5b57\u7b26\u4e32s\u8f6c\u6362\u4e3a\u5927\u5199\u5f62\u5f0f
\u8bf4\u660e\uff1a\u53ea\u8f6c\u6362s\u4e2d\u51fa\u73b0\u7684\u5c0f\u5199\u5b57\u6bcd\uff0c\u4e0d\u6539\u53d8\u5176\u5b83\u5b57\u7b26\u3002\u8fd4\u56de\u6307\u5411s\u7684\u6307\u9488\u3002
\u4e3e\u4f8b\uff1a
// strupr.c
#include
#include
main()
{
char *s="Copywrite 1999-2000 GGV Technologies";
clrscr();
printf("%s",strupr(s));
getchar();
return 0;
}
(A\uff09 s\u548cp\u5b8c\u5168\u76f8\u540c
a\u7684\u7c7b\u578b\u662fcha\u6570\u7ec4
p\u7684\u7c7b\u578b\u662fchar\u6307\u9488
\u4e0d\u4e00\u6837
\uff08B\uff09\u6570\u7ec4s\u4e2d\u7684\u5185\u5bb9\u548c\u6307\u9488\u53d8\u91cfp\u4e2d\u7684\u5185\u5bb9\u60f3\u7b49
\u6570\u7ec4s\u4e2d\u7684\u5185\u5bb9\u662f: "china"
\u6307\u9488\u53d8\u91cfp\u4e2d\u7684\u5185\u5bb9\u662f: s[0]\u7684\u5730\u5740\uff08&s[0]\uff09
\u4e00\u4e2a\u662f\u5b57\u7b26\u4e32 \u4e00\u4e2a\u662f\u5730\u5740
\u4e0d\u4e00\u6837
\uff08C\uff09s\u6570\u7ec4\u957f\u5ea6\u548cp\u6240\u6307\u5411\u7684\u5b57\u7b26\u4e32\u957f\u5ea6\u76f8\u7b49
s\u6570\u7ec4\u957f\u5ea6\u5305\u62ec '\0'\u7684\u4f4d\u7f6e
p\u6240\u6307\u5411\u7684\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u5305\u62ec '\0'\u7684\u4f4d\u7f6e
s\u6570\u7ec4\u957f\u5ea6 == p\u6240\u6307\u5411\u7684\u5b57\u7b26\u4e32\u957f\u5ea6 + 1 (1\u5c31\u662f'\0'\u5360\u6709\u7684\u4f4d\u7f6e)
\u663e\u7136 \u4e0d\u76f8\u7b49
int i;char a[n],*p=a;for(i=0;i<n;i++){if(*p+i>='a'&&*p+i<=z)printf("%s",*p);}for(i<n;i>=0;i--)printf("%s",*p);
#include<stdio.h>
#include<string.h>
int main()
{
char a[100],*p;
int len;
while(scanf("%s",a)!=EOF)
{
len=strlen(a);
p=a;
for(;p<a+len;p++)
if(*p>='a'&&*p<='z')
{
*p=*p-32;
}
for(p=a+len-1;p>=a;p--)
printf("%c",*p);
printf("\n");
}
return 0;
}
绛旓細鍦C璇█鐨勪笘鐣岄噷锛屽熀纭姒傚康鏄悊瑙i珮绾х壒鎬х殑鍏抽敭銆傛湰鏂囧皢甯︿綘鎺㈢储鏁扮粍銆佹寚閽堢殑濂ョ锛屼互鍙婂畠浠湪閫掑綊鍜岀粨鏋勪綋涓殑搴旂敤銆1. 鏁扮粍涓庢寚閽鍩虹 鏁扮粍鏄繛缁瓨鍌ㄧ浉鍚岀被鍨嬪厓绱犵殑闆嗗悎锛屽 int arr[5]銆傛暟缁勫垵濮嬪寲鍙互涓嶅畬鍏ㄦ寚瀹氶暱搴︼紝濡傚瓧绗︿覆褰㈠紡銆俿izeof 鐢ㄤ簬鑾峰彇鏁扮粍鎴栫被鍨嬫墍鍗犲唴瀛樼┖闂达紝鑰 strlen 鍒欑敤浜庤绠...
绛旓細C璇█涓锛屾暟缁勫拰鎸囬拡鏄袱涓笉鍚岀殑姒傚康锛屽畠浠箣闂村瓨鍦ㄦ樉钁楃殑鍖哄埆锛氬畾涔変笌鏈川锛氭暟缁勬槸涓绉嶆暟鎹粨鏋勶紝鐢ㄤ簬瀛樺偍鍥哄畾鏁伴噺鐨勫悓绫诲瀷鍏冪礌鐨勮繛缁唴瀛樺潡銆傝屾寚閽堟槸涓涓彉閲忥紝鍏跺兼槸涓涓唴瀛樺湴鍧锛岀敤浜庢寚鍚戝唴瀛樹腑鐨勬煇涓綅缃傚唴瀛樺垎閰嶏細鏁扮粍鍦ㄧ紪璇戞椂鍒嗛厤鍐呭瓨绌洪棿锛屽叾澶у皬鍦ㄥ0鏄庢椂纭畾涓斿浐瀹氫笉鍙樸傛寚閽堟湰韬彧鍗犵敤鍥哄畾...
绛旓細int a[9]={1,2,3,4,5,6,7,8,9}锛/*鍘熸潵鐨勪唬鐮佸彲鑳戒細鎶ラ敊锛屽洜涓轰綘瀹氫箟鐨鏁扮粍澶у皬鏄8锛屼絾鏄祴鍊肩殑鏁扮粍鍏冪礌鏈9涓紝闇瑕佸皢鏁扮粍a[8]鏀规垚a[9]*/ int b[3]={0}锛沬nt *p锛沺=a锛沚[0] = p[2]; b[1] = p[6]; b[2] = p[8];浠ヤ笂浠g爜浼氭妸瀵瑰簲鐨勬暟鎹厓绱犵殑鍊兼斁鍒版暟鎹産涓
绛旓細鎸囬拡锛氭寚閽寰堢伒娲伙紝瀹冨彲浠ユ寚鍚戜换鎰忕被鍨嬬殑鏁版嵁銆傛寚閽堢殑绫诲瀷璇存槑浜嗗畠鎵鎸囧悜鍦板潃绌洪棿鐨勫唴瀛樸傛寚閽堬細鐢变簬鎸囬拡鏈韩灏辨槸涓涓彉閲忥紝鍐嶅姞涓婂畠鎵瀛樻斁鐨勪篃鏄彉閲忥紝鎵浠ユ寚閽堢殑瀛樺偍绌洪棿涓嶈兘纭畾銆3.姹俿izeof 鏁扮粍锛氭暟缁鎵鍗犲瓨鍌ㄧ┖闂寸殑鍐呭瓨锛歴izeof锛堟暟缁鍚嶏級鏁扮粍鐨勫ぇ灏忥細sizeof锛堟暟缁勫悕锛/sizeof锛堟暟鎹被鍨嬶級鎸囬拡锛氬湪...
绛旓細鍙互涓嶅畾涔夊瓧绗鏁扮粍锛鑰屽畾涔変竴涓瓧绗鎸囬拡銆傜敤瀛楃鎸囬拡鎸囧悜瀛楃涓蹭腑鐨勫瓧绗︺俒渚8.12]void main(void){char *string="I Love China!";printf("%s\n",string);} 鍦ㄨ繖閲屾病鏈夊畾涔夊瓧绗︽暟缁勶紝浣C璇█瀵瑰瓧绗︿覆甯搁噺鏄寜瀛楃鏁扮粍澶勭悊鐨勶紝瀹為檯涓婂湪鍐呭瓨寮杈熶簡涓涓瓧绗︽暟缁勭敤鏉ュ瓨鏀惧瓧绗︿覆鏁扮粍銆傚湪绋嬪簭涓畾涔変簡...
绛旓細鍐呰挋浜篲yanjun 閲囩撼鐜:27% 鎿呴暱: 缂栫▼璇█ 鍏朵粬鍥炵瓟 #include<stdio.h>#define X 10;x涓鏁扮粍闀垮害瑕佹敼鐩存帴鏀瑰悗闈㈢殑鏁板瓧void main(){ int array[X+1]; //闀垮害涓簒+1,鏈鍚庝竴涓厓绱犱负array[x] int n,i,j; scanf("%d",&n);//璇诲彇寰幆娆℃暟for(i=0;i<X;i++)scanf("%d",&array[i]); //璇...
绛旓細杩欎竴杩欓噷pa鏄竴涓寚鍚戞寚閽堢殑鎸囬拡锛*pa鏄竴涓寚閽堬紝鑰宎rray[i]鏄竴涓彉閲忓硷紝璧嬪肩粰涓涓寚閽堣偗瀹氫笉瀵逛簡銆傚彟澶朼rray[i]鏄笉绛変簬array+i鐨锛宎rray[i] == *(array+i)锛宎rray+i鏄竴涓湴鍧銆
绛旓細1銆侀鍏堬紝瀹氫箟涓涓ご鏂囦欢cstdio銆2銆佹帴鐫锛屽畾涔変袱涓狥ILE鏂囦欢缁撴瀯鎸囬拡绫诲瀷鍙橀噺锛岀敤鏉ヨ鍏ュ拰鍐欏叆瀛楃銆3銆佸畾涔変竴涓瓧绗鏁扮粍s锛屽苟灏嗗叾鍚勫厓绱犵殑鍊煎垵濮嬪寲涓0銆4銆佷互鍙鐨勬柟寮忥紝鎵撳紑杈撳叆鏂囦欢銆5銆佷互鍙啓鐨勬柟寮忥紝鎵撳紑杈撳嚭鏂囦欢銆6銆佸皢杈撳叆鏂囨湰涓殑瀛楃涓诧紝璇诲叆瀛楃鏁扮粍s涓7銆佸皢瀛楃鏁扮粍s涓殑姣忎釜瀛楃鍚...
绛旓細绗竴绉嶏細include<stdio.h>void Calculate(float *pfloat);int main(){ float a[10]; int i; for(i=0;i<10;i++) { printf("Please Enter %d Data\n",i+1); scanf("%f\n",&a[i]); } Calculate(a); printf("Calculate After"); for(i=0;i<10...
绛旓細鍥犳 锛屾垜浠湅鍑猴紝B鐨勪綔鐢ㄥ氨鐩稿綋浜鎸囬拡p浣滅敤..鏄惂锛熷彧鏄痯鐨勫煎彲浠ュ彉锛孊涓嶅彲浠ワ紝鎵浠鏄父鎸囬拡銆傛槸涓绾х殑锛屾寚鍚戜竴涓猧nt鍏冪礌锛堢涓涓厓绱狅級銆2锛夊悓鐞嗭紝鎴戜滑鐪 int B[3][4]={0}...杩欎釜鏄竴涓3*4鐨勪簩缁鏁扮粍锛B[0],B[1],B[2]閮芥槸涓涓竴缁存暟缁勬槸鍚э紵鍙互鎯冲儚鎴愯繖涓牱瀛愶細int (B[0]...