作业帮 > 综合 > 作业

北大ACM,Presentation Error,

来源:学生作业帮 编辑:灵鹊做题网作业帮 分类:综合作业 时间:2024/04/29 05:45:26
北大ACM,Presentation Error,
Output
The output will only be the converted number as it would appear on the display of the calculator.The number should be right justified in the 7-digit display.If the number is to large to appear on the display,then print ``ERROR'' (without the quotes) right justified in the display.
#include
#include
using namespace std;
int bas(char c)
{
if(isalpha(c))
return c - 'A' + 10;
return c - '0';
}
int main()
{
char str[8];
int l,b1,b2,n,k,num[10];
while(cin >> str >> b1 >> b2)
{
n = k = 0;
l = strlen(str);
for(int i=0; i 7) cout
北大ACM,Presentation Error,
第28行," ERROR"改为"ERROR",不带空格,试试.
再问: 还是不行,感觉是右对齐的问题,
再答: 那改为" ERROR",带2个空格,我看问题要求7位,ERROR占五位,左边加2个空格;而且你的输出数字,也都这么处理,试试