I'm new to c++ and I have no idea what I'm doing. My assignment is to Please write a C++ program to find the area of a square, input the length of the side, and output your answer to the screen. Can anyone help me with what to do?
To get the input use std::cin
To output the result use std::cout
If you don't know what I'm talking about I'm sorry but you need to pick up the book and review
#include <iostream>
usingnamespace std;
int main()
{
int side;
cout << "Input length of side: " << endl;
cin >> side;
int area = side * side;
cout << "area is: " << area << endl;
return 0;
}
#include <iostream> //basic libraries
#include <cstdio>
#include <cstdlib>
usingnamespace std; // removes std::
int main()
{
int side; // creates variable side
cout << "Input length of side: "; // prompts user
cin >> side; // stores input into variable side
cout << endl; // new line
int area = side * side; // new variable area which is side * side
cout << "area is: " << area << endl; // outputs area
system("PAUSE"); // pauses program
return 0; // ends program
}