Function not working...

Write your question here.
I am up to the third part part I have to have my name print the amount of times that the two largest variables added up to, and I'm a bit lost. Any help would be much appreciated.

Just for extra clarity:
2. The main program will call a function named findsum(), sending it the three integer values. The function will determine the sum of the larger 2 of the three values, sending the answer back to the main program.

The main program will print the value returned. For example, if you send 4 6 2 to the function, the function will return 10, (4+6) and the main program will print that 10 is the sum.



3. The main program will call a function named printmyname(), sending it one parameter -- the sum of the integer values. The function will print your name that many times, and the function will not return a value. (Be careful – see below.)

For example, if the parameter to the function is 2, then the function should print your name 2 times. If the parameter is 4, the function should print your name 4 times.

However, if the parameter sent in is less than or equal to 0, or if the parameter sent in is greater than 10, the function will say it is not possible to print the name. For example, if the parameter is -2, the function will say in this case it is not possible to print the name. If the parameter is 12, the function will say it is not possible to print the name.

This is what I have so far:
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <iostream>

using namespace std;

void introduction();

void printmyname(int sum);

int findsum (int,int,int);

int main()
{
    int x=10, y=20, z=30, printsum;

introduction();
cout<<endl;

printsum=findsum(x,y,z);

cout<<printsum;

void printmyname();


}

void introduction()
{
    cout<<"test";
}


int findsum(int a,int b,int c)
{
    int sum;


    if ( a < b )
    {
        int temp = a; a = b; b = temp;
    }



    if ( b < c )
    {
        int temp = b; b = c; c = temp;
     }

    sum = a + b;

    return sum;

}


void printmyname(int sum)
{
    int x;
    for(x=1; x<=sum; x++)
    cout<<"Bob";



}
line 22:
You don't have a parameter in that function, and there's no need to put void in front of that function
Topic archived. No new replies allowed.