Click here to Skip to main content
15,908,674 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CStatic background color problem Pin
Prakash Nadar15-Feb-04 19:55
Prakash Nadar15-Feb-04 19:55 
GeneralRe: CStatic background color problem Pin
Coremn16-Feb-04 11:45
Coremn16-Feb-04 11:45 
GeneralRe: CStatic background color problem Pin
Prakash Nadar16-Feb-04 16:40
Prakash Nadar16-Feb-04 16:40 
GeneralSave Bitmap from Device Context to File Pin
Okeno Palmer15-Feb-04 17:14
Okeno Palmer15-Feb-04 17:14 
GeneralRe: Save Bitmap from Device Context to File Pin
Johann Gerell15-Feb-04 20:14
Johann Gerell15-Feb-04 20:14 
GeneralWeird toolbar behaviour Pin
Deian15-Feb-04 16:18
Deian15-Feb-04 16:18 
GeneralHelp...program passes input as 13... Pin
kfresh15-Feb-04 15:47
kfresh15-Feb-04 15:47 
GeneralRe: Help...program passes input as 13... Pin
Andrew Walker15-Feb-04 16:37
Andrew Walker15-Feb-04 16:37 
[rant]
This is what comes from using NON-STANDARD code.
Don't post homework
RTFM - Console::Read returns the next character from the input stream
[/rant]

#include <iostream>
#include <string>

using namespace std;

const double PI = 3.14159265;

void calcCircle(double r)
{
    cout << "Radius: " << r << endl;
    cout << "Area:   " << PI * r * r << endl;
    cout << "Perim:  " << 2 * PI * r << endl;
}

void calcTriangle(double b, double h, double s)
{
    cout << "Area:  " << 0.5 * b * h << endl;
    cout << "Perim: " << b * 2 * s << endl;
}

void calcSquare(double x)
{
    cout << "Area:  " << x*x << endl;
    cout << "Perim: " << 4*x << endl;
}

int main()
{
    cout << "1 triangle" << endl;
    cout << "2 square" << endl;
    cout << "3 circle" << endl;
    int menuSelection;
    cin >> menuSelection;
    switch(menuSelection)
    {
        case 1:
        {
            double b,h,s;
            cout << "Enter Base: ";
            cin >> b;
            cout << "Enter Height: ";
            cin >> h;
            cout << "Enter Side: ";
            cin >> s;
            calcTriangle(b,h,s);
            break;
        }
        case 2:
        {
            double r;
            cout << "Enter Radius: ";
            cin >> r;
            calcCircle(r);
            break;
        }
        case 3:
        {
            double x;
            cout << "Enter Side: ";
            cin >> x;
            calcSquare(x);
            break;
        }
        default:
            cout << "Invalid" << endl;

    }
	return 0;
}




If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.

Rudyard Kipling

General.ico corruption and CVS Pin
Jon Sagara15-Feb-04 15:30
Jon Sagara15-Feb-04 15:30 
GeneralRe: .ico corruption and CVS Pin
Mike Dimmick16-Feb-04 2:42
Mike Dimmick16-Feb-04 2:42 
GeneralRe: .ico corruption and CVS Pin
Jon Sagara16-Feb-04 2:48
Jon Sagara16-Feb-04 2:48 
GeneralAddPicture Pin
Member 73893815-Feb-04 15:10
Member 73893815-Feb-04 15:10 
GeneralFree Unix OS download.. Pin
IrishSonic15-Feb-04 14:41
IrishSonic15-Feb-04 14:41 
GeneralRe: Free Unix OS download.. Pin
Maxwell Chen15-Feb-04 15:14
Maxwell Chen15-Feb-04 15:14 
GeneralRe: Free Unix OS download.. Pin
Anonymous15-Feb-04 19:37
Anonymous15-Feb-04 19:37 
GeneralRe: Free Unix OS download.. Pin
Okeno Palmer16-Feb-04 1:23
Okeno Palmer16-Feb-04 1:23 
GeneralRe: Free Unix OS download.. Pin
IrishSonic17-Feb-04 13:22
IrishSonic17-Feb-04 13:22 
GeneralA simple problem Pin
deniz79s15-Feb-04 6:10
deniz79s15-Feb-04 6:10 
GeneralRe: A simple problem Pin
Mike Dimmick16-Feb-04 2:59
Mike Dimmick16-Feb-04 2:59 
GeneralMFC control and value variable conflict Pin
Dev57815-Feb-04 5:31
Dev57815-Feb-04 5:31 
GeneralRe: MFC control and value variable conflict Pin
Michael Dunn15-Feb-04 5:35
sitebuilderMichael Dunn15-Feb-04 5:35 
GeneralRe: MFC control and value variable conflict Pin
Prakash Nadar15-Feb-04 19:59
Prakash Nadar15-Feb-04 19:59 
GeneralRe: MFC control and value variable conflict Pin
jhwurmbach16-Feb-04 0:08
jhwurmbach16-Feb-04 0:08 
GeneralRe: MFC control and value variable conflict Pin
Prakash Nadar16-Feb-04 2:54
Prakash Nadar16-Feb-04 2:54 
GeneralRe: MFC control and value variable conflict Pin
jhwurmbach16-Feb-04 3:09
jhwurmbach16-Feb-04 3:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.