0
Why this code doesn’t work? It should write vertical an int
This is the code: #include <iostream> using namespace std; void write_vertical(int n){ if(n<10){ cout<<n<<endl; } else{ return write_vertical(n/10); cout<<n%10<<endl; } } int main() { int n; cin>>n; cout << "start" << endl; stampa_verticale(n); cout << "end" << endl; } There is the code, where there is the recursive function write_vertical. It should get a integer number from the input and print the number in vertical form; for example 123 should be printed 1 2 3.
2 Réponses
+ 5
Probably because in main you are calling a function named stampa_verticale and not write_vertical.