Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

No errors, but no output...?

bbopalunaabbopalunaa Member Posts: 1
My programs builds fine, but when I try to run it, there is no output and I cannot figure out what's wrong with it. Any help would be greatly appreciated.

[code]#include

using namespace std;

void get_Data(int num1, int num2);
void is_Divisible(int num1, int num2);

int num1, num2;

int main()
{
void get_Data(int num1, int num2);
void is_Divisible(int num1, int num2);

}

void get_Data(int num1, int num2)
{
cout << "Enter two integers: " << endl;
cin >> num1 >> num2;
}

void is_Divisible(int num1, int num2)
{
int remainder;

remainder = num1 % num2;

if (remainder = 0)
cout << num1 << " is evenly divisible by " << num2 << endl;

else
cout << num1 << " is not evenly divisible by " << num2 << endl;
}[/code]

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [color=Blue]See RED. Also, study parameter passing here:[/color]
    [link=http://www.ensta.fr/~diam/c++/online/notes-cpp/functions/refparams.html]http://www.ensta.fr/~diam/c++/online/notes-cpp/functions/refparams.html[/link]

    : [code]: #include
    :
    : using namespace std;
    :
    : void get_Data(int num1, int num2);
    : void is_Divisible(int num1, int num2);
    :
    : int num1, num2;
    :
    : int main()
    : {
    : [color=Green]//void get_Data(int num1, int num2);
    : //void is_Divisible(int num1, int num2);[/color]
    : [color=Red]get_Data (num1, num2);
    : is_Divisible (num1, num2);[/color]
    : }
    :
    : void get_Data(int num1, int num2)
    : {
    [color=Green]// This ^^^ will not work. If you need to return
    // some values from a function you need to use
    // pointers or references.[/color]
    : cout << "Enter two integers: " << endl;
    : cin >> num1 >> num2;
    : }
    :
    : void is_Divisible(int num1, int num2)
    : {
    : int remainder;
    :
    : remainder = num1 % num2;
    :
    : if (remainder = 0)
    : cout << num1 << " is evenly divisible by " << num2 << endl;
    :
    : else
    : cout << num1 << " is not evenly divisible by " << num2 << endl;
    : }[/code]:
    :
Sign In or Register to comment.