有人可以帮助我发现问题并纠正它。 [英] Can someone help me to Spot the problems and correct it.

查看:56
本文介绍了有人可以帮助我发现问题并纠正它。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include <cstdlib>
#include <iostream>
#define NUM 10

using namespace std;

char city[]="Penang";
int count;

int main(int argc, char *argv[])
{
    int abc;
    count = NUM;
    abc = 5;
    do_var_fun();
    cout<<abc<<" "<<count<<" "<<pgm_var<< " " <<xyz;
    system("PAUSE");
    return EXIT_SUCCESS;
}

int pgm_var = 7;

void do_var_fun()
{
    char xyz ='A';
    xyz = 'b';
    cout <<xyz<<" "<<pgm_var <<" " <<abc<< " "<<city;
    return;
}

推荐答案

#include <cstdlib>
#include <iostream>
#define NUM 10
 
using namespace std;
 
char city[]="Penang";
int count;
int pgm_var = 7;
void do_var_fun();

int main(int argc, char *argv[])
{
    int abc;
    count = NUM;
    abc = 5;
    do_var_fun();
    cout<<abc<<" "<<count<<" "<<pgm_var<< " " <<xyz;
    system("PAUSE");
    return EXIT_SUCCESS;
}
 

 
void do_var_fun()
{
    char xyz ='A';
    xyz = 'b';
    cout <<xyz<<" "<<pgm_var <<" " <<abc<< " "<<city;
    return;
}


这篇关于有人可以帮助我发现问题并纠正它。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆