Click here to Skip to main content
15,921,467 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Please Help!! Pin
Christian Graus4-Nov-02 12:22
protectorChristian Graus4-Nov-02 12:22 
GeneralRe: Please Help!! Pin
Chris Losinger4-Nov-02 12:23
professionalChris Losinger4-Nov-02 12:23 
GeneralRe: Please Help!! Pin
Christian Graus4-Nov-02 12:33
protectorChristian Graus4-Nov-02 12:33 
GeneralRe: Please Help!! Pin
Chris Losinger4-Nov-02 15:01
professionalChris Losinger4-Nov-02 15:01 
GeneralRe: Please Help!! Pin
Christian Graus4-Nov-02 15:17
protectorChristian Graus4-Nov-02 15:17 
GeneralRe: Please Help!! Pin
Chris Losinger4-Nov-02 17:29
professionalChris Losinger4-Nov-02 17:29 
GeneralRe: Please Help!! Pin
Autunmsky4-Nov-02 12:57
Autunmsky4-Nov-02 12:57 
GeneralRe: Please Help!! Pin
Christian Graus4-Nov-02 13:12
protectorChristian Graus4-Nov-02 13:12 
#include < iostream >
#include < string >

using std::cout;
using std::cin;
using std::endl;
using std::string;


const string EQUIL = "equilateral";
const string ISOS = "isosceles";
const string SCALE = "scalene";


void DisplayOpeningScreen();
void Print6BlankLines();

int main()

{
   int side1 = 0;
   int side2 = 0;
   int side3 = 0;
   int halfper = 0;
   int area = 0;
   string sType;


// Display an opening screen and explain the program to the user

DisplayOpeningScreen();


// Have the user input 3 values representing the sides of a triangle

cout << "\nEnter first side of triangle: ";
cin >> side1;
cout << "Enter second side of triangle: ";
cin >> side2;
cout << "Enter thrid side of triangle: ";
cin >> side3;


if ((side1 + side2) > side3 && (side2 + side3) > side1 && (side1 + side3) > side2)
{ 

  cout << "\n\nThe three lengths can form a triangle.\n\n";

  if ((side1 == side2) && (side2 == side3) && (side1 == side3))
       sType= EQUIL;
   else if ((side1 == side2) || (side2 == side3) || (side1 == side3))
       sType = ISOS;
   else;
       sType = SCALE;

   cout << "This triangle is an " << sType << " triangle.  \r\n\r\n";

}
else
{
   cout << "\n\nThe three lengths can not form a triangle.\n\n";
}


Assuming the maths is all right ( I don't know ), this should work fine. Note I do not call endl over and over ( it does a flush as well and can be expensive ), I initialise my numeric variables, and I use only the bits of std that I need.





return 0;

}


Christian

No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002

Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002

During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
GeneralRe: Please Help!! Pin
Autunmsky4-Nov-02 14:29
Autunmsky4-Nov-02 14:29 
GeneralHelp with Dialog Toolbars Pin
Steven M Hunt4-Nov-02 10:33
Steven M Hunt4-Nov-02 10:33 
GeneralRe: Help with Dialog Toolbars Pin
dabs4-Nov-02 10:50
dabs4-Nov-02 10:50 
GeneralCMenu question. Pin
Anonymous4-Nov-02 10:11
Anonymous4-Nov-02 10:11 
QuestionHow do i at runtime, draw a bitmap in my application? Pin
Anonymous4-Nov-02 9:45
Anonymous4-Nov-02 9:45 
AnswerRe: How do i at runtime, draw a bitmap in my application? Pin
Christian Graus4-Nov-02 9:56
protectorChristian Graus4-Nov-02 9:56 
Generalyes Pin
Anonymous4-Nov-02 10:31
Anonymous4-Nov-02 10:31 
GeneralRe: yes Pin
Christian Graus4-Nov-02 11:06
protectorChristian Graus4-Nov-02 11:06 
QuestionDo we really need "UINT mask"? Pin
MightyThor4-Nov-02 9:27
MightyThor4-Nov-02 9:27 
AnswerRe: Do we really need "UINT mask"? Pin
Christian Graus4-Nov-02 9:55
protectorChristian Graus4-Nov-02 9:55 
GeneralRe: Do we really need "UINT mask"? Pin
MightyThor4-Nov-02 9:59
MightyThor4-Nov-02 9:59 
GeneralRe: Do we really need "UINT mask"? Pin
Christian Graus4-Nov-02 10:34
protectorChristian Graus4-Nov-02 10:34 
GeneralRe: Do we really need "UINT mask"? Pin
MightyThor4-Nov-02 10:49
MightyThor4-Nov-02 10:49 
AnswerRe: Do we really need "UINT mask"? Pin
Daniel Turini4-Nov-02 9:55
Daniel Turini4-Nov-02 9:55 
GeneralRe: Do we really need "UINT mask"? Pin
MightyThor4-Nov-02 10:26
MightyThor4-Nov-02 10:26 
Generalscroll using middle button Pin
orcun colak4-Nov-02 8:54
orcun colak4-Nov-02 8:54 
GeneralRe: scroll using middle button Pin
lucy4-Nov-02 9:39
lucy4-Nov-02 9:39 

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.