需要帮助制作带有星号的字母

Need help making letters with asterisks

本文关键字:帮助 作带      更新时间:2023-10-16

我必须在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的底部。