Maza
Video Editor
Hello all,
I have been learning C++ for about a week & I am trying to make a basic area & perimeter calculator where the user puts in the length and the width and the program will take care of the rest but I am having troubles on finding what is wrong, Maybe someone here can help ?
Also if you see anything wrong with the way I code please tell me, Still am extremely new and learning.
I have been learning C++ for about a week & I am trying to make a basic area & perimeter calculator where the user puts in the length and the width and the program will take care of the rest but I am having troubles on finding what is wrong, Maybe someone here can help ?
Also if you see anything wrong with the way I code please tell me, Still am extremely new and learning.
Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int length;
int width;
int perimeter;
int area;
perimeter = 2 * (length + width);
area = length * width;
cout << "Welcome to the area and perimeter calculator\n";
system("pause\n");
cout << "Please enter the length\n";
cin >> length; // Where user enter's length
system("pause\n");
cout << "Please enter the width\n";
cin >> width; // Where user enter's width
system("pause\n");
cout << "perimeter calculated successfully\n";
system("pause\n");
cout << "The perimeter is: /n";
cout << perimeter << endl; // permimeter gets displayed here
system("pause\n");
cout << "The area is: \n"; // area gets displayed here
cout << area << endl;
system("pause");
return 0;
}