2015-10-13 61 views
0

我试过在谷歌搜索结果上阅读几个不同的帮助论坛结果,它们都不适用于我的情况。我的Netbeans 8.0.2没有显示任何输出。我的程序有cout的功能,其他的主要有cout。什么都没有出现。踢球者是没有返回的错误。不知道你们是否可以帮助我,但我仍然充满希望。netbeans没有显示C++输出

操作系统:Ubuntu的LTS 14.04

Netbean版本:8.0.2

下面是一个例子代码:

#include <cstdlib> 
#include <iostream> 
#include <iomanip> 
using namespace std; 

class calender 
{ 
private: 
    int month; 
    int day; 
    int year; 
public: 
    void getdate(int m, int d, int y); 
    void showdate(); 
}; 

void calender::getdate(int m, int d, int y){ 
     m=month; 
     d=day; 
     y=year; 
} 

void calender::showdate(){ 
     cout<<"The date is:"<<setfill('0')<<setw(2)<<month<<"/"<<setw(2)<<day 
       <<"/"<<setw(2)<<year<<endl; 
} 

int main() { 
    int month, day, year; 
    char contin; 
    while (contin=='y'){ 
    calender c1; 
    cout<<"What is the month: "; 
    cin>>month; 
    cout<<"What is the day: "; 
    cin>>day; 
    cout<<"What is the year: "; 
    cin>>year; 
    c1.getdate(month,day,year); 
    c1.showdate(); 
    cout<<"Do you want to continue(y/n): "; 
    cin>>contin; 
    } 
    return 0; 
} 

回答

0

编辑:那是愚蠢的我 - 作为编写,代码无论如何不会有任何输出。您从不初始化变量contin,因此while循环中的条件语句永远不会计算为true。你确定这不是你的问题吗?

+0

我展示了代码,以便在代码中存在某些内容时可以运行该代码,我只想涵盖所有基础。其次,是的,我知道哪里和我得到的窗口(内部终端和外部终端)闪烁的文本持有者。这个程序的输出不是一个单一的东西。 –