UVA 706 LCD
来源:互联网 发布:软件过程规范名词解释 编辑:程序博客网 时间:2024/04/29 05:09
为什么打印出来是两个分隔的竖线???
真心给跪了。。。、
#include <iostream>#include <sstream>#include <cstdio>#include <cstring>#include <cmath>#include <string>#include <vector>#include <set>#include <cctype>#include <algorithm>#include <cmath>#include <deque>#include <queue>#include <map>#include <stack>#include <list>#include <iomanip>using namespace std;///#define INF 0xffffff7#define maxn 10010/////下面为0~9字符表示int P[10][7] = {{1, 1, 1, 0, 1, 1, 1},{0, 0, 1, 0, 0, 1, 0},{1, 0, 1, 1, 1, 0, 1},{1, 0, 1, 1, 0, 1, 1},{0, 1, 1, 1, 0, 1, 0},{1, 1, 0, 1, 0, 1, 1},{1, 1, 0, 1, 1, 1, 1},{1, 0, 1, 0, 0, 1, 0},{1, 1, 1, 1, 1, 1, 1},{1, 1, 1, 1, 0, 1, 1}};void printRow(int s, int num, int rank){int i, j;if (rank == 1){if (P[num][0] == 0){for (i = 0; i < s + 2; i++)printf(" ");}else{for (i = 0; i < s + 2; i++){if (i == 0 || i == s + 1)printf(" ");elseprintf("-");}}}if (rank == 3){if (P[num][3] == 0){for (i = 0; i < s + 2; i++)printf(" ");}else{for (i = 0; i < s + 2; i++){if (i == 0 || i == s + 1)printf(" ");elseprintf("-");}}}if (rank == 5){if (P[num][6] == 0){for (i = 0; i < s + 2; i++)printf(" ");}else{for (i = 0; i < s + 2; i++){if (i == 0 || i == s + 1)printf(" ");elseprintf("-");}}}}void printfCol(int s, int num,int rank){int i, j;if (rank == 2){if (P[num][1] == 1)printf("|"); //为什么打印出来是分隔的两个竖线?elseprintf(" ");for (i = 1; i <= s; i++)printf(" ");if (P[num][2] == 1)printf("|");elseprintf(" ");}if (rank == 4){if (P[num][4] == 1)printf("|");elseprintf(" ");for (i = 1; i <= s; i++)printf(" ");if (P[num][5] == 1)printf("|");elseprintf(" ");}}char num[20];int main(){///int i, j, k;int s;while (1){scanf("%d", &s);if (s == 0)break;scanf("%s", num);int len = strlen(num);//一共输出广义5行 1 + s + 1 + s + 1行for (i = 1; i <= 5; i++){//如果是奇数行if (i % 2 == 1){//一共len个字符,每个字符采用printRow函数输出,字符之间输出空格for (j = 0; j < len; j++){int tempNum;tempNum = num[j] - '0';printRow(s, tempNum, i);if (j != len - 1)printf(" "); //最后一个数后面不输出空格}if (i != 5)printf("\n");//输出一个空行}//如果是偶数行selse{for (j = 0; j < s; j++){//一共len个字符for (k = 0; k < len; k++){int tempNum = num[k] - '0';printfCol(s, tempNum, i);if (k != len - 1)printf(" ");}printf("\n");//输出一个空行}}}printf("\n");} /// return 0;}
- UVa 706 - LCD Display
- UVA 706 LCD
- uva 706 LCD Display
- UVa 706 LCD Display
- UVa 706 - LCD Display
- UVa 706 / POJ 1102 LCD Display (模拟)
- UVA 706 - LCD Display(液晶显示器)
- UVA 706 - LCD Display(液晶显示器)
- UVA 706 LCD Display 液晶显示屏 (字符串模拟)
- HOJ 10593 UVA 706 - LCD Display(水题)
- 706 - LCD-Display
- LCD
- lcd
- lcd
- lcd
- LCD
- lcd
- LCD
- xmp标签和pre标签【鸡蛋】
- Oracle 中如何删除重复数据的多种方法
- 【数据结构】希尔排序
- 七夕,染红了我的相思
- nginx状态监控
- UVA 706 LCD
- Eclipse常用快捷方式
- 2012年华为杯校园编程大赛决赛 类别:软件C/C++语言
- tomcat解决中文乱码问题及tomcat的配置
- 试用 wps 2012 抢先版(发个牢骚)
- 中国近700年灵异事件浏览表!
- C++中extern “C”含义深层探索 zz
- 用Android-X86和VirtualBox打造高性能Android开发环境
- Mysql-忘记密码-密码修改