• 这种代码为何不合法...问题出在红色字的一行

    漂移的Rain Wed, 06 May 2009 19:56:07 +0000

    [i=s] 本帖最后由 漂移的Rain 于 2009-5-6 20:02 编辑
    #include
    #include
    #include
    using namespace std;
    int main(){
    srand(time(NULL));
    int x=rand()%10;
    int type;
    cin>>type;
    switch (type){
    case 1:cout

  • # 1

    humboldtpenguin Thu, 07 May 2009 13:54:08 +0000

    switch()似乎不能直接用来打印...也不能当成运算符号....
    不止要改红色那行...最好整个改掉...
    把计算过程全放到switch()里头....

  • # 2

    小光 Thu, 07 May 2009 20:21:51 +0000

    switch不是函数 不能返回值,坚持要用到话就自己定义个函数吧
    把switch放进去