0

Program existed with code 0

Hello everyone, I have been using visual studio for C++ programming but i recently noticed that I was not getting any output. Only, 'program existed with code 0'. here is my code: #include<iostream> #include <stdlib.h> using namespace std; int printNum (int num){ return num; } int main() { printNum(5); system("Pause"); return 0; } The program should return 5 but it does not return anything.

6th Aug 2019, 3:38 AM
Leo Hunter
Leo Hunter - avatar
1 Resposta
+ 1
Return is not equal to print. Remember this. In the code you gave, printNum(5) is equal to 5, but that's it. printNum() doesn't print anything, so you have to do cout << printNum(5); Or edit your function: void printNum(int num) { cout << num; }
6th Aug 2019, 4:11 AM
你知道規則,我也是
你知道規則,我也是 - avatar