language: C++ 4.7.2 (gcc-4.7.2)
date: 101 days 16 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// ourfunc.cpp -- defining your own function
#include <iostream>
void simon(int); // function prototype for simon() -- This tells the compiler that there is going to be an integer in the simon function? also why void?
 
int main()
{
    using namespace std;
    simon(3);   // call the simon() function -- Is this line assigning integer 3 to simon for use in int n later?
    cout << "Pick an integer: ";
    int count;
    cin >> count;
    simon(count);   // call it again -- This is assigning whatever input integer user puts in into variable count?
    cout << "Done!" << endl;
    cin.get();
    cin.get();
    return 0;
 
}
 
void simon(int n)   // define the simon() function -- void? Explanation? Also why does it say int n now instead of count?
{
    using namespace std;
    cout << "Simon says touch your toes " << n << " times." << endl; // So int n took the input value from count and used it, how?
}   // void functions don't need return statements -- Why?