23,215
社区成员




#include<stdio.h>
#include<ctype.h>
int main(void)
{ char d,c;
printf("Enter a first and last name :");
scanf(" %c",&d);
while ((c=getchar())!=' ')
;
while ((c=getchar())!='\n')
{ if (c==' ')
;
else
putchar(c);
}
printf(",%c",d);
return 0;
}
抱歉 少了句#include<stdio.h>
#include<ctype.h>
int main(void)
{ char d,c;
printf("Enter a first and last name :");
scanf(" %c",&d);
while ((c=getchar())!=' ')
;
while ((c=getchar())!='\n')
{
putchar(c);
}
printf(",%c",d);
return 0;
}
刚做到这题,嘿嘿 试了一下,应该可以
struct info
{
string firstname;
string lastname;
char calon;
char end;
};
D:\temp\pp>more temp.py
#coding:utf-8
#windows7+python3.2
def main():
firstname=input('please input your first name:').strip()
lastname=input('please input your last name:').strip()
print(lastname+','+firstname[0]+'.')
if __name__=='__main__':
main()
D:\temp\pp>python temp.py
please input your first name:jeans
please input your last name:smith
smith,j.