Comment this code line by line
Comment each line and said why we use
#include <iostream>
#include <vector>
#include <stdlib.h>
#include <cmath>
using namespace std;
class RightAngleTriangle{
private:
vector<int> Point2DA, Point2DB, Point2DC;
float AC,AB,BC;
public:
RightAngleTriangle(){}
void Input(){
int X;
int Y;
cout<<"Enter X coordinate for point A: ";
cin>>X;
cout<<"Enter Y coordinate for point A: ";
cin>>Y;
Point2DA.push_back(X);
Point2DA.push_back(Y);
cout<<"Enter X coordinate for point B: ";
cin>>X;
cout<<"Enter Y coordinate for point B: ";
cin>>Y;
Point2DB.push_back(X);
Point2DB.push_back(Y);
cout<<"Enter X coordinate for point C: ";
cin>>X;
cout<<"Enter Y coordinate for point C: ";
cin>>Y;
Point2DC.push_back(X);
Point2DC.push_back(Y);
#include <iostream> //library for input, output
#include <vector> //library for using vector
#include <stdlib.h> //the header file defines several general purpose functions
#include <cmath> //Header declares a set of functions to compute common mathematical operations and transformations
using namespace std; //a group of functions that are part of the std standard library
class RightAngleTriangle{ //class declaration
private: //declaring class members with private access
vector<int> Point2DA, Point2DB, Point2DC;//declaration of three variables (class members) of type vector integer
float AC,AB,BC; //declaration of three variables (class members) of float type
public:
RightAngleTriangle(){} //public default constructor
void Input(){//input method
int X; //declaration of variable X
int Y;//declaration of variable Y
cout<<"Enter X coordinate for point A: "; //ask the user to enter the value X for A
cin>>X; //write the entered value into the variable X
cout<<"Enter Y coordinate for point A: ";//ask the user to enter the value Y for A
cin>>Y; //write the entered value into the variable Y
Point2DA.push_back(X);//put the received data at the end of the vector Point2DA
Point2DA.push_back(Y);//put the received data at the end of the vector Point2DA
cout<<"Enter X coordinate for point B: ";//ask the user to enter the value X for B
cin>>X;//write the entered value into the variable X
cout<<"Enter Y coordinate for point B: ";//ask the user to enter the value Y for B
cin>>Y;//write the entered value into the variable Y
Point2DB.push_back(X);//put the received data at the end of the vector Point2DB
Point2DB.push_back(Y);//put the received data at the end of the vector Point2DB
cout<<"Enter X coordinate for point C: ";//ask the user to enter the value X for C
cin>>X;//write the entered value into the variable X
cout<<"Enter Y coordinate for point C: ";//ask the user to enter the value Y for C
cin>>Y;//write the entered value into the variable Y
Point2DC.push_back(X);//put the received data at the end of the vector Point2DC
Point2DC.push_back(Y);//put the received data at the end of the vector Point2DC
Comments
Leave a comment