title: How to show float if the user inputs a digit with a decimal and int if the user inputs a whole number using function overloading
body: <p>I am currently studying C++ by watching <a href="http://thenewboston.org/watch.php?cat=16&amp;number=30" rel="nofollow">bucky's C++ tutorial</a>.</p>
  
  <p>In the tutorial he shows how to use function overloading
  but the variables values of <code>a</code> and <code>b</code> are fixed in his tutorial video. 
  I'm wondering what happens if the user needs to input something (decimal or whole number)
  and how to make the program identify whether the input data is an int or an float.</p>
  
  <p>here is the code in the tutorial video:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void printnumber(int x){
      cout &lt;&lt; "I am printing an integer " &lt;&lt;x &lt;&lt; endl;
  }
  
  void printnumber(float x){
      cout &lt;&lt; "I am printing an float: " &lt;&lt; x &lt;&lt; endl;
  }
  
  
  int main(){
  
      int a = 54;
      float b= 32.4896;
  
      printnumber(a);
      printnumber(b);
  
  }
  </code></pre>
  
  <p>While here is the code I created:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int a;
  float b;
  
  void printnumber(int x){
      cout &lt;&lt; "I am printing an integer " &lt;&lt;x &lt;&lt; endl;
  }
  
  void printnumber(float x){
      cout &lt;&lt; "I am printing an float: " &lt;&lt; x &lt;&lt; endl;
  }
  
  
  int main(){
  
      cout &lt;&lt; "enter a whole number or a number with decimal: ";
      cin &gt;&gt; ; //what will i put here?
  
      printnumber(a);
      printnumber(b);
  
  }
  </code></pre>