Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,332 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,107 people online right now. Registration is fast and FREE... Join Now!




area and perimeter program

 
Reply to this topicStart new topic

area and perimeter program, Trouble with cin char

confuzius
post 15 Mar, 2008 - 12:22 AM
Post #1


New D.I.C Head

*
Joined: 9 Mar, 2008
Posts: 9


My Contributions


Hey

I'm trying to write a console program that will work out th area or perimeter of a square, rectangle, triangle or circle. I'm having trouble with an if condition after a cin character is requested from the user. Here's the code:

CODE
#include <cstdlib>
#include <iostream>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{char aorp;
cout << "Do you want to work out an area problem or a perimeter problem? If area, type a, if perimeter, type p." << endl;
cin >> aorp;

if (aorp) == (a)


this if condition returns an "expected primary-expression before '= =' token.

ANy help would be appreciated. Also, is there any way to let the user choose to terminate the program after working out one area or perimeter problem, or running the program another time?

Thanks in advance, folks.
User is offlineProfile CardPM

Go to the top of the page

confuzius
post 15 Mar, 2008 - 01:00 AM
Post #2


New D.I.C Head

*
Joined: 9 Mar, 2008
Posts: 9


My Contributions


No worries - problem solved!
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/22/08 03:11AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month