求大神帮改一下错误哈
#include <stdio.h>#include <stdlib.h>
void print( int b)
{
int t=0;
for(t=0;t<b;t++)
{
printf(" ");
}
}
int main()
{
char a;
scanf("%c",&a);
int b;
if(a>=97 && a<=122 )
b=a-96;
else if(a>=65 && a<=90)
b=a-64;
else
{printf("Invalid character!\n");return 0;}
int i,j;
int z;
for(i=0;i<b;i++)
{
print(b-i-1);
for(j=0;j<=i;j++)
{
z=65+j;
printf("%s",&z);
}
for(j=i-1;j>=0;j--)
{
z=65+j;
printf("%s",&z);
}
printf("\n");
}
return 0;
}
可是系统一直这样回复:
cc1plus: warnings being treated as errors
main.cpp: In function ‘int main()’:
main.cpp:30: error: format ‘%s’ expects type ‘char*’, but argument 2 has type ‘int*’
main.cpp:35: error: format ‘%s’ expects type ‘char*’, but argument 2 has type ‘int*’