在主函数之后定义几个函数,采用函数调用形式,输出下面的图形。 ****** @@@@@@ ******
时间: 2023-07-11 15:49:48 浏览: 51
好的,以下是代码实现:
```c
#include <stdio.h>
void printStarLine() {
printf("******\n");
}
void printAtLine() {
printf("@@@@@@\n");
}
int main() {
printStarLine();
printAtLine();
printStarLine();
return 0;
}
```
输出结果为:
```
******
@@@@@@@
******
```
相关问题
在主函数之后定义几个函数,采用函数调用形式,输出下面的图形。 ****** @@@@@@ ******c语言实现
好的,以下是代码实现:
```c
#include <stdio.h>
void printStarLine() {
printf("******\n");
}
void printAtLine() {
printf("@@@@@@\n");
}
int main() {
printStarLine();
printAtLine();
printStarLine();
return 0;
}
```
输出结果为:
```
******
@@@@@@@
******
```
用c语言写出在主函数之后定义几个函数,采用函数调用形式,输出下面的图形。 ****** @@@@@@@ ******
好的,以下是代码实现:
```c
#include<stdio.h>
void printStars(); // 打印星号函数
void printAts(); // 打印 @ 函数
int main()
{
printStars(); // 调用打印星号函数
printAts(); // 调用打印 @ 函数
printStars(); // 再次调用打印星号函数
return 0;
}
void printStars()
{
printf("******\n"); // 打印星号
}
void printAts()
{
printf("@@@@@@@\n"); // 打印 @
}
```
输出结果为:
```
******
@@@@@@@
******
```
注意,在 `main` 函数之后定义了两个函数 `printStars` 和 `printAts`,这两个函数分别实现了打印星号和打印 @ 的功能,然后在 `main` 函数中依次调用这两个函数即可输出图形。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.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)