|
[root@PP root]# g++ sj008.c
sj008.c:1: parse error before `for'
sj008.c:1:36: missing terminating ' character
sj008.c:1:36: warning: character constant too long
sj008.c:2: parse error before `to'
In file included from /usr/include/c++/3.2.2/iosfwd:45,
from /usr/include/c++/3.2.2/ios:44,
from /usr/include/c++/3.2.2/ostream:45,
from /usr/include/c++/3.2.2/iostream:45,
from sj008.c:3:
/usr/include/c++/3.2.2/bits/stringfwd.h:55: parse error before `<' token
/usr/include/c++/3.2.2/bits/stringfwd.h:58: confused by earlier errors, bailing out
我的代码是:
#include <iostream>
#include <conio.h>
int main()
{
int ten,count,sxtn;
int gch[16];
do{
sxtn=0;
cout << "请输入0~65535:";
cin >> ten;
if (ten < 0 || ten > 65535)
cout << "It's a WRONG number!Please input again!\n";
}
while(ten < 0 || ten > 65535);
for (count = 0;count <= 15;count++)
{
gch[count]=ten%2;
sxtn+=gch[count];
ten=ten/2;
}
for (count = 15;count >= 0;count--)
cout << "二进制数:" << gch[count];
getch();
return 0;
}
我是初学者,请大家高抬贵手帮帮忙,谢谢大家啦!!! |
|