| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
求助啊!Presentation Error!下面是带文件输出的!帮忙看看吧!ths!看看文件输出的格式有什么问题,谢了
#include<iostream>
#include<fstream>
using namespace std;
bool figureofdigit[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 display(int s, char* digit) {
ofstream outf("output.txt");
for(int j = 0; j < 7; j++) {
int temp = 0,temp1 = 0,i = 0;
switch ( j ) {
case 0: case 3: case 6://cout << "flag1 " << j << endl ;
for(i = 0; digit[i] != '\0'; i++) {
cout << ((i == 0) ? " " : " ");
outf << ((i == 0) ? " " : " ");
for(temp = s; temp; temp--) {
cout << ((figureofdigit[digit[i]-'0'][j] == 0) ? ' ' : '-');
outf << ((figureofdigit[digit[i]-'0'][j] == 0) ? ' ' : '-');
}
cout << " ";
outf << " ";
}
cout << endl;
outf << endl;
break;
case 1: case 4://cout << "flag2 " << j << endl ;
for(temp = s; temp; temp--) {
for(i = 0; digit[i] != '\0'; i++) {
if(i != 0) { cout << ' '; outf << ' '; }
cout << ((figureofdigit[digit[i]-'0'][j] == 0) ? ' ' : '|');
outf << ((figureofdigit[digit[i]-'0'][j] == 0) ? ' ' : '|');
for(temp1 = s; temp1; temp1--) { cout << ' '; outf << ' '; }
cout << ((figureofdigit[digit[i]-'0'][j+1] == 0) ? ' ' : '|');
outf << ((figureofdigit[digit[i]-'0'][j+1] == 0) ? ' ' : '|');
}
cout << endl;
outf << endl;
}
break;
default : break;
}
}
}
int main() {
int size;
char digit[11];
cin >> size >> digit;
while(size != 0 || digit[0] != '0') {
display(size, digit);
cin >> size >> digit;
}
return 0;
}
/*
figureofdigit[0] = { 1 1 1 0 1 1 1 };
figureofdigit[1] = { 0 0 1 0 0 1 0 };
figureofdigit[2] = { 1,0,1,1,1,0,1 };
figureofdigit[3] = { 1,0,1,1,0,1,1 };
figureofdigit[4] = { 0,1,1,1,0,1,0 };
figureofdigit[5] = { 1,1,0,1,0,1,1 };
figureofdigit[6] = { 1,1,0,1,1,1,1 };
figureofdigit[7] = { 1,0,1,0,0,1,0 };
figureofdigit[8] = { 1,1,1,1,1,1,1 };
figureofdigit[9] = { 1,1,1,1,0,1,1 };*/
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator