字符型数据输出和占位
Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description
输入一个字符,请你按如下要求输出:
第一行字符数据默认输出,
第二行字符型数据输出共占 4 位,右对齐,左补 3 个空格并在两端添加星号包裹,
第三行字符型数据输出共占 4 位,左对齐,右补 3 个空格并在两端添加星号包裹。
Input
输入一个字符 。
Output
共三行,按题目描述输出。
Sample Input
c
Sample Output
c
* c*
*c *
Hint
Source
行走的二叉树
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
char n;
scanf("%c",&n);
printf("%c\n",n);
printf("*%4c*\n",n);
printf("*%-4c*\n",n);
return 0;
}