c++ loop help

my do and while loop isnt working, when the program runs it asks the user is they want to continue but when i hit Y it just says press any key to continue.

//Ezaz Choudhry
//Project 2
//determining Triangle Shapes
//cps 130


#include <iostream>
using namespace std;


// defining my data type of triangles.
enum Triangles { equilateral,isosceles,scalene, noTriangle};

// Prototype.
void getSides (int &s1, int &s2, int &s3);
Triangles getShape(int s1, int s2, int s3);
void Display(Triangles myShape);

int main()
{

//Triangle Side Variables.
int s1,s2,s3;

char response;

Triangles myShape;

getSides(s1,s2,s3);
myShape=getShape(s1,s2,s3);
Display(myShape);

do
{

cout << "Do you wish to quit (Y or N) : ";
cin >> response;
response = toupper (response);
} while (response == 'N');

system("pause");
return 0;
}


// Get Traingle Sides from user.
void getSides (int &s1, int &s2, int &s3)
{


cout << "Enter side 1 of your Triangle: ";
cin >> s1;

cout << "Enter side 2 of your Triangle: ";
cin >> s2;

cout << "Enter side 3 of your Triangle: ";
cin >> s3;
}



//determining which Traingle it is based on the 3 numbers the user entered.
Triangles getShape(int s1, int s2, int s3)
{

Triangles myShape;
//if side 1 +s2 is less then or equal to s3 or vise versa, then you dont have a vlaid triangle.
if (s1+s2 <=s3 || s1+s3 <=s2 || s2+s3 <=s1)
{
myShape = noTriangle;
return myShape;

}

// if side 1 is equal to side 2 and side 2 is equal to side 3 ,you have valid triangle.
else if (s1==s2 && s2==s3)
{
myShape = equilateral;
return equilateral;


}

// if side 1 is equal to side 2 or side 1 is equal to side 3 or side s2 is equal to side 3 ,you have a vlid triangle.
else if (s1==s2 || s1==s3 || s2==s1)
{

myShape = isosceles;
return myShape;

}

// if all you sides are different but two sides are greater then the third side ,you have a valid triangle.
else
{
myShape = scalene;
return myShape;
}
//returns myshape which holds the 4 triangle variables ,back to main.
return myShape;
}



void Display(Triangles myShape)
{
switch (myShape)
{
case noTriangle: cout << " You dont have vaild Triangle please try again..... " ; break;
case equilateral:cout << " You have a equilateral Triangle..... " ; break;
case isosceles: cout << " You have a isosceles Triangle..... " ; break;
case scalene: cout << " You have a scalene Triangle....." ; break;
}







}
Never mind i put a N instead of Y
Topic archived. No new replies allowed.