您的位置:首页 > 娱乐 > 明星 > 查询网站流量排名_企业名录搜索网站_石家庄限号_长沙seo平台

查询网站流量排名_企业名录搜索网站_石家庄限号_长沙seo平台

2025/4/30 3:16:03 来源:https://blog.csdn.net/2301_79601258/article/details/147495287  浏览:    关键词:查询网站流量排名_企业名录搜索网站_石家庄限号_长沙seo平台
查询网站流量排名_企业名录搜索网站_石家庄限号_长沙seo平台

文章目录

  • 前言
  • 一、题目
  • 二、解题思路
  • 结语

前言

本次训练内容

  1. 训练解题思维
  2. 一周一次的洋文题训练

一、题目

Little Ke was admitted to the University and became a freshman. At the begin of their first year,  Little Ke was hard-working and selected as the monitor. In order to be close to his teachers, please help him to write a program to ask teachers' names, and then print a message to tell him/her that it's nice to meet him/her.

输入格式

a string with length L (0<=L<=2^10)

输出格式

a sentence that meet the condition.

样例输入

Sean

样例输出

What is your name? Hello Sean, nice to meet you.

二、解题思路

        首先先翻译这道题:“小柯被大学录取,成为大一新生。第一年伊始,小柯勤奋努力,被选为班长。为了接近他的老师,请帮助他写一个程序来询问老师的名字,然后打印一条消息告诉他/她很高兴见到他/她。”你会发现题目描述和解题一点关系都没有……(真是绷不住了)。然后我们观察后面的样例,哦!!!原来就是打出一句话,把那个名字加入即可哈哈哈。

#include <iostream>
#include <string>
using namespace std;
int main() {string s;getline(cin,s);printf("What is your name? Hello %s, nice to meet you.",s.c_str());
}

 记得使用getline,因为没说不使用空格。

总结

        在最后发现是因为没写getline问题的时候,我已经有些许破防了,已经第二次这样了,我得错过几次才能记住啊!!!!好吧实话说,一开始我都没想到会有空格,想着就是一个简单的字符串输入输出,吃一堑长一智.2,希望它能就停留在.2了,希望各位看到了也留个心眼。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com