需要帮助制作带有星号的字母
Need help making letters with asterisks
我必须在c++中使用星号制作字母"T"、"O"answers"L"。代码要求提供尺寸和字母。这就是我到目前为止所拥有的。老实说,我一点都不擅长循环,我该如何制作循环?一些循序渐进的解释也将受到赞赏。非常感谢。这是我的密码。
#include<iostream>
using namespace std;
int main()
{
char T, O, L;
char letter;
int number, size;
size = number % 2;
cout << "Welcome to the letter printer." << endl;
cout << "Enter the size : " << endl;
cin >> size;
while (size <= 5 || size == 0)
{
cout << "Invalid size. Enter the size again: ";
cin >> size;
}
cout << "Enter the letter: " << endl;
cin >> letter;
while (letter != 'T' && letter != 'O' && letter != 'L')
{
cout << "Invalid Letter. Enter the letter again:";
cin >> letter;
{
while (letter == 'T')
{
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
cout << "*";
}
cout << endl;
}
}
}
}
我们不是来帮你解决家庭作业的。你的问题太开放了,除了"我知道怎么做,请帮我做"之外,没有其他实际问题。如果我必须推荐一些步骤,我会说用星号在txt文件中画出每个字母。然后弄清楚哪些部分需要循环,哪些部分需要打印出来。
例如T。我会先在T的顶部打印一行星号来解决这个问题。然后做一个循环,打印出一个每侧都有空白的星号,次数可以是你认为应该的次数,以制作T的底部。
相关文章:
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 使用不带参数的函数访问结构元素
- 不带大括号的枚举形式
- 带内存和隔离功能的SQLite
- 需要帮助设置在C++中使用的Potrace
- 在指针的帮助下,文本文件中单词的频率
- 带过滤器的现代迭代c++集合
- 用于C++中带有数组和指针的循环
- 计算每个节点的树高,帮助我解释这个代码解决方案
- 将静态库链接到不带-fPIC的共享库中
- 如何在C++中用std::cout正确显示带十六进制的字符串文本
- 如何在Qbutton的帮助下更改Q对话框的宽度
- 检查不带转换的扫描格式
- 需要帮助将结构数组传递给函数
- 在C++游戏中与库存系统作斗争
- 带结构的二维矢量:如何存储元素
- 检查TCHAR数组输入是否为带符号整数C++
- C++需要帮助从用户那里获得一个整数,并确保它在另外两个整数之间
- 带有数组键C++的二进制映射
- 需要帮助在同一行打印不带空格的序列