相关疑难解决方法(0)

Visual Studio 2010在计划结束后退出

我正在通过编译C程序来尝试Visual Studio 2010.在"DOS"命令窗口中显示解决方案后,窗口立即关闭.在Visual Studio 2008中,可以按任意键获取消息以继续,按一个键可关闭命令提示符窗口.如何在2010年设置此行为?

c visual-studio-2010 visual-studio

9
推荐指数
1
解决办法
2万
查看次数

getchar()不能正常工作?

我用C++编写了这段代码,我常常使用getchar()控制台,但我没有看到使用该函数的任何影响,这里是代码:

#include<iostream>
#include<stdio.h>//to pause console screen

using namespace std;
//function prototypes
int  getSmallest(int*);
int getOccurrence(int, int*);

int main(){

    int a[7], counter=0, smallest;
    cout<<"Please enter 7 integers"<<endl;
    while(counter!=7){
        cin>>a[counter];
        counter++;
    }
    smallest=getSmallest(a);
    cout<<"The smallest number is "<<smallest<<"; it apears "<<getOccurrence(smallest,a)<<" times"<<endl;
    getchar();//to pause console screen
    return 0;
}

int  getSmallest(int*x){
int count=0, smallest=*x;
//loop till last item in array
while(count!=7){

    if(*x<smallest)
        smallest=*x;
    count++;
    x++;
}
return smallest;
}


int getOccurrence(int smallest, int* address){

int count=0,occ=0;
//loop till last item …
Run Code Online (Sandbox Code Playgroud)

c++ getchar

1
推荐指数
1
解决办法
3万
查看次数

标签 统计

c ×1

c++ ×1

getchar ×1

visual-studio ×1

visual-studio-2010 ×1