我写这个程序对吗?我怎么运行不出来,显示有一个错!如下:
#include<stdio.h>
#include<string.h>
const int maxline=2;
char a[maxline][80];
void ConvertCharA()
{
int i,j;
for(i=0;i<maxline;i++)
for(j=0;j<80;j++)
{
if(a[i][j]>='a'&&a[i][j]<'z'||a[i][j]>='A'&&a[i][j]<'Z')
a[i][j]+=1;
else
if(a[i][j]=='Z')
a[i][j]='A';
else
if(a[i][j]=='z')
a[i][j]='a';
}
}
int main()
{
int i;
strcpy(a[0],"Adb.Bcdza");
strcpy(a[1],"abck.LLhj");
ConvertCharA();
for(i=0;i<maxline;i++)
printf("%s\n",a[i]);
}
你试试..把你的;改成了;
#include<stdio.h>
#include<string.h>
const int maxline=2;
char a[maxline][80];
void ConvertCharA()
{
int i,j;
for(i=0;i<maxline;i++)
for(j=0;j<80;j++)
{
if(a[i][j]>='a'&&a[i][j]<'z'||a[i][j]>='A'&&a[i][j]<'Z')
a[i][j]+=1;
else
if(a[i][j]=='Z')
a[i][j]='A';
else
if(a[i][j]=='z')
a[i][j]='a';
}
}
int main()
{
int i;
strcpy(a[0],"Adb.Bcdza");
strcpy(a[1],"abck.LLhj");
ConvertCharA();
for(i=0;i<maxline;i++)
printf("%s\n",a[i]);
}
#include<stdio.h>
#include<string.h>
#define maxline 2
char a[maxline][80];
void ConvertCharA()
{
int i,j;
for(i=0;i<maxline;i++)
for(j=0;j<80;j++)
{
if(a[i][j]>='a'&&a[i][j]<'z'||a[i][j]>='A'&&a[i][j]<'Z')
a[i][j]+=1;
else
if(a[i][j]=='Z')
a[i][j]='A';
else
if(a[i][j]=='z')
a[i][j]='a';
}
}
int main()
{
int i;
strcpy(a[0],"Adb.Bcdza");
strcpy(a[1],"abck.LLhj");
ConvertCharA();
for(i=0;i<maxline;i++)
printf("%s\n",a[i]);
}