内存不能为read问题!求解答!
#include<stdio.h>int jianpan()
{
printf(" ╭╮\n");
printf(" ││\n");
printf("┏━━━━━━━━━━━━┷┷┓\n");
printf("┃┌────────────┐┃\n");
printf("┃│手机输入法 │┃\n");
printf("┃│ │┃\n");
printf("┃│ │┃\n");
printf("┃└────────────┘┃\n");
printf("┃╭─╮ ╭─╮┃\n");
printf("┃│C │ │OK│┃\n");
printf("┃╰─╯ 手机输入法模拟 ╰─╯┃\n");
printf("┃┌───┐┌──┐┌───┐┃\n");
printf("┃│7PQRS ││8TUV││9WXYZ │┃\n");
printf("┃└───┘└──┘└───┘┃\n");
printf("┃┌───┐┌──┐┌───┐┃\n");
printf("┃│4GHI ││5JKL││6MNO │┃\n");
printf("┃└───┘└──┘└───┘┃\n");
printf("┃┌───┐┌──┐┌───┐┃\n");
printf("┃│1 . ││2ABC││3DEF │┃\n");
printf("┃└───┘└──┘└───┘┃\n");
printf("┗━━━━━━━━━━━━━━┛\n");
printf("\n");
printf("tip:找不到你想输入的汉字吗?!按x键试试!\n");
printf("\n");
return 0;
}
void main()
{
int n,i=0,j,s,t,m,k=0,y=0;
char cun[300],*p;
char pin_a[]={"阿啊哎哀唉埃挨皑癌矮蔼艾爱隘碍安氨鞍俺岸按案胺暗"};
char pin_b[]={"八巴叭扒吧芭疤捌笆拔跋把靶坝爸罢霸白百佰柏摆败拜"};
char pin_c[]={"擦嚓礤猜才材财裁采彩睬踩菜蔡参餐残蚕惭惨灿操糙曹"};
char pin_d[]={"搭达答瘩打大哒嗒褡沓呆歹傣代带待怠殆贷袋逮戴丹单"};
char pin_e[]={"讹俄娥峨鹅蛾额厄扼恶饿鄂遏恩嗯摁蒽奀儿而尔耳洱饵"};
char pin_f[]={"发乏伐罚阀筏法珐帆番翻藩凡矾钒烦樊繁反返犯泛饭范"};
char pin_g[]={"嘎噶咖尕伽呷戈皋羔疙哥胳鸽割搁歌阁革格葛隔个各铬"};
char pin_h[]={"蛤哈酣憨含邯毫豪嚎函涵寒韩罕喊汉汗旱悍捍焊憾撼翰"};
char pin_j[]={"讥击饥圾机肌鸡迹姬积基绩缉畸箕稽激及吉汲级蓟冀藉"};
char pin_k[]={"咖喀卡坷苛科棵颗磕壳咳可渴克刻客课开揩槛凯看慨楷"};
char pin_l[]={"垃拉啦喇腊蜡辣兰拦栏婪阑蓝谰澜篮览揽缆懒烂滥郎狼"};
char pin_m[]={"妈麻马玛码蚂骂吗嘛没枚玫眉梅媒煤酶霉每美镁妹昧媚"};
char pin_n[]={"拿哪那纳娜钠呐妮尼泥倪霓你拟逆匿溺腻拈年捻撵碾念"};
char pin_o[]={"哦欧殴鸥呕偶藕沤"};
char pin_p[]={"趴啪爬耙琶帕怕抨砰烹朋彭棚硼蓬鹏澎篷膨捧碰霹皮毗"};
char pin_q[]={"七沏妻柒凄栖戚期欺漆祁齐其奇歧祈脐崎畦骑棋旗乞器"};
char pin_r[]={"然燃冉染人仁壬忍刃认任纫妊韧戎绒茸荣容溶蓉熔融冗"};
char pin_s[]={"撒洒萨山删杉衫珊煽闪陕汕苫扇善缮擅膳赡栅梢烧稍勺"};
char pin_t[]={"她他它塌塔獭挞踏蹋坍贪摊滩瘫坛谈痰谭潭檀坦袒毯叹"};
char pin_w[]={"哇娃挖洼蛙瓦袜危威微巍为韦围违桅唯惟维潍伟伪尾侮"};
char pin_x[]={"虾瞎匣侠峡狭暇辖霞下吓夏铣仙先纤掀锨鲜闲弦贤咸涎"};
char pin_y[]={"丫压呀押鸦鸭牙芽蚜崖涯衙哑雅亚讶炎研盐阎蜒颜奄严"};
char pin_z[]={"匝杂砸咋喳渣扎札轧闸铡眨乍诈炸榨柞遭糟凿早枣蚤澡"};
jianpan();
while(scanf("%d",&n)!=EOF)
{
switch(n)
{
case 2:
getchar();
printf("*| ");
for(i=0,j=0;(pin_a[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_a[i],pin_a[i+1]);
printf(" |*\n");
p=pin_a;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_a[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_a[i],pin_a[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 22:
getchar();
printf("*| ");
for(i=0,j=0;(pin_b[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_b[i],pin_b[i+1]);
printf(" |*\n");
p=pin_b;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_b[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_b[i],pin_b[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 222:
getchar();
printf("*| ");
for(i=0,j=0;(pin_c[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_c[i],pin_c[i+1]);
printf(" |*\n");
p=pin_c;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_c[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_c[i],pin_c[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 3:
getchar();
printf("*| ");
for(i=0,j=0;(pin_d[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_d[i],pin_d[i+1]);
printf(" |*\n");
p=pin_d;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_d[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_d[i],pin_d[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 33:
getchar();
printf("*| ");
for(i=0,j=0;(pin_e[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_e[i],pin_e[i+1]);
printf(" |*\n");
p=pin_e;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_e[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_e[i],pin_e[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 333:
getchar();
printf("*| ");
for(i=0,j=0;(pin_f[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_f[i],pin_f[i+1]);
printf(" |*\n");
p=pin_f;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_f[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_f[i],pin_f[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 4:
getchar();
printf("*| ");
for(i=0,j=0;(pin_g[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_g[i],pin_g[i+1]);
printf(" |*\n");
p=pin_g;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_g[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_g[i],pin_g[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 44:
getchar();
printf("*| ");
for(i=0,j=0;(pin_h[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_h[i],pin_h[i+1]);
printf(" |*\n");
p=pin_h;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_h[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_h[i],pin_h[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 5:
getchar();
printf("*| ");
for(i=0,j=0;(pin_j[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_j[i],pin_j[i+1]);
printf(" |*\n");
p=pin_j;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_j[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_j[i],pin_j[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 55:
getchar();
printf("*| ");
for(i=0,j=0;(pin_k[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_k[i],pin_k[i+1]);
printf(" |*\n");
p=pin_k;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_k[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_k[i],pin_k[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 555:
getchar();
printf("*| ");
for(i=0,j=0;(pin_l[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_l[i],pin_l[i+1]);
printf(" |*\n");
p=pin_l;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_l[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_l[i],pin_l[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 6:
getchar();
printf("*| ");
for(i=0,j=0;(pin_m[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_m[i],pin_m[i+1]);
printf(" |*\n");
p=pin_m;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_m[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_m[i],pin_m[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 66:
getchar();
printf("*| ");
for(i=0,j=0;(pin_n[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_n[i],pin_n[i+1]);
printf(" |*\n");
p=pin_n;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_n[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_n[i],pin_n[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 666:
getchar();
printf("*| ");
for(i=0,j=0;(pin_o[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_o[i],pin_o[i+1]);
printf(" |*\n");
p=pin_o;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_o[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_o[i],pin_o[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 7:
getchar();
printf("*| ");
for(i=0,j=0;(pin_p[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_p[i],pin_p[i+1]);
printf(" |*\n");
p=pin_p;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_p[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_p[i],pin_p[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 77:
getchar();
printf("*| ");
for(i=0,j=0;(pin_q[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_q[i],pin_q[i+1]);
printf(" |*\n");
p=pin_q;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_q[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_q[i],pin_q[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 777:
getchar();
printf("*| ");
for(i=0,j=0;(pin_r[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_r[i],pin_r[i+1]);
printf(" |*\n");
p=pin_r;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_r[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_r[i],pin_r[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 7777:
getchar();
printf("*| ");
for(i=0,j=0;(pin_s[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_s[i],pin_s[i+1]);
printf(" |*\n");
p=pin_s;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_s[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_s[i],pin_s[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 8:
getchar();
printf("*| ");
for(i=0,j=0;(pin_t[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_t[i],pin_t[i+1]);
printf(" |*\n");
p=pin_t;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_t[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_t[i],pin_t[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 9:
getchar();
printf("*| ");
for(i=0,j=0;(pin_w[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_w[i],pin_w[i+1]);
printf(" |*\n");
p=pin_w;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_w[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_w[i],pin_w[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 99:
getchar();
printf("*| ");
for(i=0,j=0;(pin_x[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_x[i],pin_x[i+1]);
printf(" |*\n");
p=pin_x;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_x[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_x[i],pin_x[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 999:
getchar();
printf("*| ");
for(i=0,j=0;(pin_y[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_y[i],pin_y[i+1]);
printf(" |*\n");
p=pin_y;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_y[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_y[i],pin_y[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
case 9999:
getchar();
printf("*| ");
for(i=0,j=0;(pin_z[i]!='\0')&&(i<20);j++,i=i+2)
printf(" %d:%c%c",j,pin_z[i],pin_z[i+1]);
printf(" |*\n");
p=pin_z;
while(t=getchar())
{
getchar();
if(t==120)
{
m=m+1;
printf("*| ");
for(s=m*20,i=s,j=0;(pin_z[i]!='\0')&&(i<s+20);j++,i=i+2)
printf(" %d:%c%c",j,pin_z[i],pin_z[i+1]);
printf(" |*\n");
}
else
break;
}
t=t+m*10;
p=p+(t-48)*2;
break;
default: y=1;
printf(" 对不起,没有您要输入的汉字!\n");
}
if(!y)
cun[k]=*p;cun[k+1]=*(p+1);
printf("%c%c\n",*p,*(p+1));
k=k+2;
jianpan();
printf("\n");
cun[k]='\0';
for(k=0;cun[k]!='\0';k=k+2)
printf("%c%c",cun[k],cun[k+1]);
printf("\n");
printf("\n");
}
}
“0x004044fd”指令引用的“0x2f54f034”内存。该内存不能为read!