Hello I'm new to c++ i need help with a area and perimeter function. I can get the program to run fine with out using it as function but cant with trying to get it to run as a function.
Here is my code:

#include <iostream>   
using namespace std;  
int main() 
 int width; 
 int length;  
 int area; 
 int perimeter;       
 cout << " Please enter the width and length of a rectangle " << endl; 
 cin >> width >> length;   
 area= width*length; 
 perimeter= 2*(width+length);      
 cout << " The area is " << area << endl; 
 cout << " The perimeter is" << perimeter << endl;        
 return 0;


but question is how can i get the area and perimeter to work as a function any help would be very much appreciated thank you.

First thing is you have to try to make it a function. Then describe the problem you are having with it. We can then offer suggestions.