c++ - 不知道如何将 "JOHN"更改为 "John"

标签 c++ string

这需要是一个 C++ 程序:

Write a complete C program to enter a first name, middle name and last name in separate variables. The user is to enter the names in all capital letters. You are to write a function to convert the names to uppercase first letter, rest of the letters lower case. Combine the names into one string and output the string (make sure you have a space between each name). Count the number of characters (including spaces) in the total name and output that.

我对字符串不太熟悉,可以使用一些指导来了解从哪里开始。

最佳答案

在 C++ 中你需要 std::stringstd::tolower , std::toupper

在 C 中,这将依赖 string manipulation in the CRT (C 运行时库)。

由于这是家庭作业,如果您再次陷入困境,这应该可以帮助您继续前进。

关于c++ - 不知道如何将 "JOHN"更改为 "John",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4139370/

相关文章:

c# - C++ 这个简单的宏在做什么?

c++ - 如何向指针数组添加元素?

c++ - 模拟游戏机的内存映射,根据提供的地址访问不同的位置

java - IntelliJ 中最常用的字符串

javascript - 为什么 "true"== true 在 JavaScript 中显示为 false?

c++ - Intellisense 不显示 Visual Studio 2019 中 cmake 项目的语法错误

c++ - 如何将 vector 转换为集合?

python - 在 python3 中格式化打印的 r(repr)

java - 用Java中的字符代码替换String

c++ - 用 C++ 编写文本/二进制文件最优雅的方法是什么?