473,394 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Returns the positive integer that you get when you reverse the digitsof parameter n

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int reverse(int n);
  5.  
  6. int main()
  7. {
  8.     int number;
  9.     int n;
  10.  
  11.     cout << " Enter number to reverse." << endl;
  12.     cin >> number;
  13.     cout << reverse(number % 10,0);
  14.  
  15.     return 0;
  16. }//end main
  17.  
  18. int reverse(int number,int n)
  19. {
  20.  
  21.     if(n < 10)
  22.     {
  23.         return n;
  24.     }
  25.     else
  26.     {
  27.         return reverse(number/10,n);
  28.     }
  29. }
Sep 8 '13 #1
1 1305
weaknessforcats
9,208 Expert Mod 8TB
You don't say what your question is, but I am guessing it's why this won't compile:

Expand|Select|Wrap|Line Numbers
  1. int reverse(int n);
  2.  
  3. int main()
  4. {
  5. etc...
You reverse function has two arguments but your prototype above shows only one argument. When the compiler sees you call reverse with two arguments, it generates a "function does not exist" message.
Sep 8 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: NotGiven | last post by:
I need to check the $_GET to make certain it is a positive integer. is_integer($_GET) is not working. I think it thinks it's a sting. So I tried casting it to an int using,...
9
by: Chris Greening | last post by:
I'm seeing a very strange problem with outer joins. The example below replicates the problem: create table data1 (dim1 integer, stat1 float); create table data2 (dim1 integer, stat2 float); ...
5
by: deko | last post by:
I've heard it said that you only want to use a number (e.g. integer, long, etc.) if you are going to do calculations or some kind of math with it. Is this true? For example, I run a validate...
8
by: Bruce Dodds | last post by:
When run manually, my query appends 14 records. When run from code using CurrentProject.Connection.Execute, the same query appends 11 records. Does anyone have an explanation of why this could be...
4
by: Alessandro Riolo | last post by:
I've got a weird thing when reverse engineering a c# project which is declaring and then using an event of type CancelEventHandler as in the following snippet: ... public event...
0
by: Shawn Hogan | last post by:
I'm getting two different results when I call System.Reflection.Assembly.GetCallingAssembly when compiling in Release and debug modes. When i compile my application using the "Debug" configuration...
0
by: RJN | last post by:
Hi I have to read an xml and add the node elements into a hashtable with nodename as key and nodetext as value. If the selected node has childnodes, then value should go as an array. for eg.,...
1
by: haelly | last post by:
write a program that prompts the user to enter three different positive integer values.If the values are not different, the program prints a message"equal value" and terminates(hint:use the return...
3
by: bfmccarthy1 | last post by:
Can anybody help me with writing this program? I do not know what function to use? 1. Prompt the user for a positive integer. 2. Print the numbers from zero to that number in the web...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.