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! :)

Recommended Answers

All 3 Replies

lol nvm I discovered why!

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

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)

:D ^^v

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.