Expected primary-expression before "..."

Hi, I'm new to c++ and I was practicing with using prototypes and calling functions by writing a simple little program to calculate the perimeter of a rectangle.

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
#include <iostream>
using namespace std; 

typedef unsigned long Ulong; //typedef for easier typing.
typedef unsigned short Ushort;

Ulong Perimeter(Ushort length, Ushort width); //Prototype.

int main()
{
    unsigned short int l, w, ans;
    cout << "Enter the Length of the Rectangle: ";
    cin >> l;
    cout << "\n";
    cout << "Now enter the width: ";
    cin >> w;
    cout << "\n";
    ans = Perimeter(Ushort l,Ushort w); //Where I am getting the error.
    cout << "The lenght you selected was: " << l << "\n";
    cout << "The width you selected was: " << w << "\n";
    cout << "The perimeter the rectangle is: " << ans;
    return 0;
}
    
    
    Ulong Perimeter(Ushort l, Ushort w)
    {
          return (2*l) + (2*w);
          }


On line 18 I am getting the error "expected primary-expression before 'l'" and expected primary-expression before 'w'". Any assistance with correcting my error would be great!
Don't pass the type with the variable, specifically, don't say Ushort l, Ushort w. It should be:
ans = Perimeter(l, w);
That worked! Thank you for your assistance!.
Topic archived. No new replies allowed.