M
M
Michael2020-10-13 02:07:28
C++ / C#
Michael, 2020-10-13 02:07:28

Why does it output 0?

#include <iostream>
#include "header.h"
using namespace std;

int main()
{
  setlocale(LC_ALL, "russian");
  int digit = 0;
  cout << NumNewline(digit);
  return 0;
}

int NumNewline(int num)
{
  cout << "Введите число: ";
  cin >> num;
  while (num)
  {
    cout << num % 10 << endl;
    num /= 10;
  }
  return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2020-10-13
@myspacebarisbroken

because
cout << NumNewline(digit);
a in the function itself is
return 0;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question