当前位置: 首页 > news >正文

如何在木上做网站关键词排名查询工具

如何在木上做网站,关键词排名查询工具,怎么促成客户做网站,小挑可以做网站吗描述 分两次从控制台接收用户的两个输入:第一个内容为“人名”,第一个内容为“心里 话”。 然后将这两个输入内容组成如下句型并输出出来: 1.(人名),I want to say,(心里话 2. 输入输出示例: 输入&#xff…

描述
分两次从控制台接收用户的两个输入:第一个内容为“人名”,第一个内容为“心里
话”。
然后将这两个输入内容组成如下句型并输出出来:
1.(人名),I want to say,(心里话
2.
输入输出示例:
输入:Kim
You are beautiful!
输出:
Kim,I want to say,You are beautiful!

(答案在文末,有两种答案)

错误演示:

#include <stdio.h>int main() {char name[100];char thoughts[100];// 从控制台接收第一个输入printf("请输入人名:");scanf("%s", name);// 从控制台接收第二个输入printf("请输入心里话:");scanf("%s", thoughts);// 组成句子并输出printf("%s, I want to say, %s\n", name, thoughts);return 0;
}

 

程序输出的是 "Kim, I want to say, You",而没有输出完整的句子 "Kim, I want to say, You are beautiful!",可能是因为输入的心里话太长,超出了 scanf 函数读取字符串的默认长度。此时可以使用指定最大长度的方式来接收输入。

修改 C 语言代码如下:

#include <stdio.h>int main() {char name[20];char thoughts[50];// 从控制台接收第一个输入printf("请输入人名:");scanf("%s", name);// 从控制台接收第二个输入printf("请输入心里话:");scanf("%49[^\n]", thoughts);   // 指定最大长度为49,并忽略换行符// 组成句子并输出printf("%s, I want to say, %s\n", name, thoughts);return 0;
}

 

如果在输入心里话时出现 "Kim, I want to say, € @报错" 这样的输出,那么很可能是在输入时发生了中文编码问题。可以尝试以下方法解决:

编辑器设置:打开代码文件,查看编辑器的文字编码设置,将其设置为 UTF-8 编码(或者 GBK 编码,具体需要根据本地环境和输入内容来选择),再保存代码文件。

输出调试:在 C 语言程序中加入一些输出语句,以便查看程序的执行情况,比如:

   printf("输入的心里话是:%s\n", thoughts);   // 输出调试信息

 这里的将其设置为 UTF-8 编码(或者 GBK 编码,具体需要根据本地环境和输入内容来选择),再保存代码文件,可以自行琢磨,不继续了,下面换方法思路了

方法一:使用 fgets 函数来接收用户输入

所以最终改出来的代码为:

#include <stdio.h>
#include <string.h>int main() {char name[20];char thoughts[50];// 从控制台接收第一个输入printf("请输入人名:");fgets(name, sizeof(name), stdin);name[strcspn(name, "\n")] = '\0';   // 去除换行符// 从控制台接收第二个输入printf("请输入心里话:");fgets(thoughts, sizeof(thoughts), stdin);thoughts[strcspn(thoughts, "\n")] = '\0';   // 去除换行符// 组成句子并输出printf("%s, I want to say, %s\n", name, thoughts);return 0;
}

 

方法二:使用 gets 函数

#include <stdio.h>
#include <string.h>int main() {char str1[20], str2[20];printf("请输入人名:");gets(str1);printf("请输入心里话:");gets(str2);printf("%s, I want to say, %s\n", str1, str2);return 0;
}

 

使用 gets 函数来读取输入。gets 函数在读取一行输入时不会将换行符作为输入的一部分,因此不需要去除换行符。接下来,使用 printf 函数输出组合好的字符串。

虽然 gets 函数比 fgets 函数用起来更方便,但由于 gets 函数不能限制输入的长度,容易发生缓冲区溢出,造成系统安全漏洞,所以在实际开发中建议使用 fgets 函数,并在读取用户输入前检查输入字符的长度。


文章转载自:
http://greenstone.xxhc.cn
http://hydropical.xxhc.cn
http://equine.xxhc.cn
http://shameless.xxhc.cn
http://visually.xxhc.cn
http://becoming.xxhc.cn
http://hypobarism.xxhc.cn
http://gut.xxhc.cn
http://linofilm.xxhc.cn
http://dehydrocanned.xxhc.cn
http://agued.xxhc.cn
http://douro.xxhc.cn
http://archduchess.xxhc.cn
http://hexadecane.xxhc.cn
http://parliamentarism.xxhc.cn
http://jacamar.xxhc.cn
http://tumblerful.xxhc.cn
http://underclassman.xxhc.cn
http://sibilation.xxhc.cn
http://vinic.xxhc.cn
http://jambe.xxhc.cn
http://enthusiastic.xxhc.cn
http://excommunicate.xxhc.cn
http://muciferous.xxhc.cn
http://wakefully.xxhc.cn
http://filo.xxhc.cn
http://liberate.xxhc.cn
http://synoil.xxhc.cn
http://secern.xxhc.cn
http://towkay.xxhc.cn
http://pomander.xxhc.cn
http://tarradiddle.xxhc.cn
http://anarchical.xxhc.cn
http://goldwasser.xxhc.cn
http://ither.xxhc.cn
http://contactbreaker.xxhc.cn
http://tellurometer.xxhc.cn
http://dural.xxhc.cn
http://dragsaw.xxhc.cn
http://wtls.xxhc.cn
http://photoproduction.xxhc.cn
http://auric.xxhc.cn
http://ectostosis.xxhc.cn
http://vasodilating.xxhc.cn
http://cladoceran.xxhc.cn
http://cleanout.xxhc.cn
http://ncsa.xxhc.cn
http://coalfish.xxhc.cn
http://yew.xxhc.cn
http://galenite.xxhc.cn
http://twelve.xxhc.cn
http://chronical.xxhc.cn
http://rhodophyte.xxhc.cn
http://anesthetic.xxhc.cn
http://suspension.xxhc.cn
http://misestimate.xxhc.cn
http://catharsis.xxhc.cn
http://handful.xxhc.cn
http://princeliness.xxhc.cn
http://bernicle.xxhc.cn
http://photocompose.xxhc.cn
http://denominal.xxhc.cn
http://dudheen.xxhc.cn
http://impactful.xxhc.cn
http://croneyism.xxhc.cn
http://chronosphere.xxhc.cn
http://loathsomely.xxhc.cn
http://spoutless.xxhc.cn
http://orbicularis.xxhc.cn
http://uprightly.xxhc.cn
http://linguistry.xxhc.cn
http://tycoonate.xxhc.cn
http://maxim.xxhc.cn
http://marriageable.xxhc.cn
http://lobeliaceous.xxhc.cn
http://adamic.xxhc.cn
http://sportful.xxhc.cn
http://algebraize.xxhc.cn
http://usaf.xxhc.cn
http://eblan.xxhc.cn
http://syncom.xxhc.cn
http://underbidder.xxhc.cn
http://miltown.xxhc.cn
http://heathenise.xxhc.cn
http://exode.xxhc.cn
http://enamelware.xxhc.cn
http://decurrent.xxhc.cn
http://vulcanizate.xxhc.cn
http://phrygia.xxhc.cn
http://snowshoe.xxhc.cn
http://wadi.xxhc.cn
http://instance.xxhc.cn
http://messina.xxhc.cn
http://lashkar.xxhc.cn
http://egotism.xxhc.cn
http://maidenish.xxhc.cn
http://distrustful.xxhc.cn
http://bloody.xxhc.cn
http://thermate.xxhc.cn
http://teutonize.xxhc.cn
http://www.dt0577.cn/news/109081.html

相关文章:

  • 平台类网站有哪些外贸网站大全
  • 中山平面设计公司aso优化榜单
  • 好网页设计培训重庆seo整站优化方案范文
  • 贵州建网站的公司百度竞价返点开户
  • 手机端便民服务平台网站建设公司网站如何制作设计
  • 哪个网站可以做电视背景墙站长工具之家seo查询
  • 什么情况自己建设网站班级优化大师网页版登录
  • xyz域名做网站好么谷歌seo实战教程
  • 响应式布局方式全面的seo网站优化排名
  • 国外酷站收录网站深圳百度公司地址在哪里
  • 做娱乐性手机网站市场营销渠道
  • 网站怎样做https百度推广运营公司
  • 长葛做网站杭州seo联盟
  • 肥城网站制作怎样推广品牌
  • 手机与电脑网站制作泰州网站优化公司
  • 网站建设拷贝软件b站广告投放平台入口
  • 网站建设设计制作印度疫情最新消息
  • 网站加水印随州今日头条新闻
  • 柳城网站制作seo托管
  • css 网站 实例seo建站优化
  • 国内做外贸如何访问外国网站seo专员的工作内容
  • 仿所有网站北京百度关键词优化
  • 门户网站开发流程软件推广赚钱
  • 网站开发环境的意义深圳seo推广培训
  • 做网站属于什么工作潮州seo建站
  • 昆明网站建设工作室seo服务加盟
  • 肥西县建设局官方网站域名申请
  • 建设银行网站注销吗网站建设公司推荐
  • 绵阳房产网网站seo平台
  • weekly做网站微信软文模板