| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1358 人关注过本帖
标题:c++ 语言 这个code 无语法错误 为什么跟我表达的意思不一样 求大神指点
只看楼主 加入收藏
lche361
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2019-6-28
收藏
 问题点数:0 回复次数:2 
c++ 语言 这个code 无语法错误 为什么跟我表达的意思不一样 求大神指点
#include <iostream>
using namespace std;
int runMenu()
{   
    cout << endl;
    cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
    cout << "      The amazing story generator     " << endl;
    cout << endl;
    cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
    cout << " [0] end testing the program          " << endl;
    cout << " [1] display 'about' information      " << endl;
    cout << " [2] read and store data from field   " << endl;
    cout << " [3] generate a random story line     " << endl;
    cout << " [4] save a story line to file        " << endl;
    cout << " [5] load saved story lines from file " << endl;
    cout << "which option would you like (0-5):    " << endl;
}
int main()
{   
    runMenu();
    cin >> option;
    if (option == 0)
    {
        cout << "bye" << endl;
        system("pause");
        return 0
    }
    else if ((option == 1) | (option == 'I'))
    {
        displayInfo();
    }
    return 0;
    system("pause");


}


c++ 萌新 问的问题可能比较低级 望见谅 谢谢
还有一个问题 最近老是碰到 路径不对是怎么个回事??
求解决方法 谢谢!!
搜索更多相关主题的帖子: c++ 语言 表达 cout option 
2019-06-28 15:40
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
收藏
得分:0 
这个code 无语法错误
怎么可能,你用的是什么编译器?
(21) : error C2065: 'option' : undeclared identifier
(22) : error C2065: 'option' : undeclared identifier
(27) : error C2143: syntax error : missing ';' before '}'
(28) : error C2065: 'option' : undeclared identifier
(28) : error C2065: 'option' : undeclared identifier
(30) : error C3861: 'displayInfo': identifier not found
(33) : error C2146: syntax error : missing ';' before identifier ';'
(33) : error C2065: ';' : undeclared identifier
(33) : error C2146: syntax error : missing ';' before identifier 'system'
9 error(s), 0 warning(s)


2019-06-28 16:29
hello_py
Rank: 2
等 级:论坛游民
威 望:1
帖 子:9
专家分:27
注 册:2019-4-21
收藏
得分:0 
貌似需要
1. #include <windows.h>
2. 定义变量 option
3. 貌似第一个"system("pause");        return 0"是多余的
4. 给出displayInfo的定义
5. 后一个return 0后面的分号不对,要换成半角分号(英文状态下的分号)
2019-06-28 19:25
快速回复:c++ 语言 这个code 无语法错误 为什么跟我表达的意思不一样 求大神指 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015169 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved