0

Hey I'm just starting to learn how to program and right now I am making a C++ tool with a Command line interface in Xcode 3 and this is my code.

#include <iostream>
using namespace std;
int main()
{
//declare input output variable
	double base=0.0;
	double height=0.0;
	double area=0.0;
	double perimeter=0.0;
	double side2=0.0;
	double side3=0.0;
//input data
	cout<< "Enter Base of Triangle" <<endl;
		cin>>base;
	cout<< "Enter Height of Triangle" <<endl;
		cin>>height;
	cout>> "Enter side 2's length" <<endl;
		cin>>side2;
	cout>> "Enter side 3's length" <<endl;
		cin>>side3;
//calculation
	area=(base*height)/2;
	perimeter=(base+side2+side3);
//display the answer
	cout<< "Area of the triangle is" <<area<< "cm2"<<endl;
	cout<< "Perimeter of the triangle is" <<perimeter<< "cm" <<endl;
	return 0;
}

according to Xcode I have 2 errors but I don't see what's wrong...

Please help, thank you! :)

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by kootech
0

lol nvm I discovered why!

cout should have been "<<"
not >> XD stupid error.

0

It's always nice if you can solve your problems yourself, congratz :) ...
(It was indeed a beginners mistake, but never mind it can overcome anyone)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.