C语言作业 实在不会做了 求大神帮忙!!!多谢!!!
答案:1 悬赏:0 手机版
解决时间 2021-02-05 21:00
- 提问者网友:相思似海深
- 2021-02-05 11:23
C语言作业 实在不会做了 求大神帮忙!!!多谢!!!
最佳答案
- 五星知识达人网友:慢性怪人
- 2021-02-05 12:07
看代码:
#include
#include
struct namect
{
char fname[20];
char lname[20];
int letters;
};
void getinfo(struct namect *pst);
void makeinfo(struct namect *pst);
void showinfo(struct namect *pst);
int main()
{
struct namect person;
getinfo(&person);
makeinfo(&person);
showinfo(&person);
return 0;
}
void getinfo(struct namect *pst)
{
printf ("Please enter your first name.
");
scanf ("%s", pst->fname);
printf ("Please enter your last name.
");
scanf ("%s", pst->lname);
}
void makeinfo(struct namect *pst)
{
pst->letters = strlen(pst->fname) + strlen(pst->lname);
}
void showinfo(struct namect *pst)
{
printf ("%s %s,your name contains %d letters
", pst->fname, pst->lname, pst->letters);
}运行:
#include
#include
struct namect
{
char fname[20];
char lname[20];
int letters;
};
void getinfo(struct namect *pst);
void makeinfo(struct namect *pst);
void showinfo(struct namect *pst);
int main()
{
struct namect person;
getinfo(&person);
makeinfo(&person);
showinfo(&person);
return 0;
}
void getinfo(struct namect *pst)
{
printf ("Please enter your first name.
");
scanf ("%s", pst->fname);
printf ("Please enter your last name.
");
scanf ("%s", pst->lname);
}
void makeinfo(struct namect *pst)
{
pst->letters = strlen(pst->fname) + strlen(pst->lname);
}
void showinfo(struct namect *pst)
{
printf ("%s %s,your name contains %d letters
", pst->fname, pst->lname, pst->letters);
}运行:
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯