请输出以下信息。(一行15个*,H前6个空格) *************** Hello! *************** 注意:语言选DEV C++。
时间: 2024-03-18 15:37:01 浏览: 23
以下是使用DEV C++输出指定信息的代码:
```cpp
#include <iostream>
using namespace std;
int main() {
cout << "***************" << endl;
cout << " Hello!" << endl;
cout << "***************" << endl;
return 0;
}
```
请注意,以上代码是使用C++语言编写的,可以在DEV C++中运行。输出结果将会是:
```
***************
Hello!
***************
```
相关问题
编写一个c程序输出*****等边三角形
好的,以下是一个输出等边三角形的C程序:
```c
#include <stdio.h>
int main() {
int n, i, j;
printf("请输入等边三角形的行数:");
scanf("%d", &n);
for(i = 1; i <= n; i++) {
for(j = 1; j <= n - i; j++) {
printf(" ");
}
for(j = 1; j <= 2 * i - 1; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
```
这个程序首先让用户输入等边三角形的行数,然后使用两层循环来输出每一行的星号。第一层循环控制行数,第二层循环控制每一行中的星号数量。在第二层循环中,第一个循环输出空格,第二个循环输出星号。
用c语言输出以下图形: * *** *****
以下是两种C语言输出图形的例子:
方法1:使用printf语句输出空格和星号
```c
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf(" *\n");
printf(" ***\n");
printf(" *****\n");
system("pause");
return 0;
}
```
方法2:使用while循环嵌套输出空格和星号
```c
#include <stdio.h>
#include <Windows.h>
#include <stdlib.h>
int main()
{
int a, b; //定义两个变量-a用来控制内循环;b用来控制外循环
char x;
x = '*';
a = 1;
while (a <= 3) //外循环-大环境-while控制行数
{
b = 1;
while (b <= 5) //内循环(五脏六腑)-while控制输出*的个数-每五个为一行
{
if (b <= 3 - a || b >= 3 + a)
{
printf(" ");
}
else
{
printf("%c", x);
}
b++;
}
printf("\n");
a++;
}
return 0;
}
```
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)