All pastes #466536 Raw Edit

Something

public text v1 · immutable
·published 2007-05-01 01:13 UTC
rendered paste body
/*
 *  tricalc.cpp
 *  
 *  Created by James Shedel on 4/17/07.
 *  Copyright 2007. All rights reserved.
 *
 */
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main ()
{
  string mystr;
  string answ;
  float first=0;
  float second=0;
  float missing=0;
  float check=0;
  bool mnhm=0;
  float answer=0;
  const int triang=180;

  cout << "Enter First Number: ";
  getline (cin,mystr);
  stringstream(mystr) >> first;
  
  if (first > 180)
  {
  cout << "Too High" << endl;
  return 0;
  } 
  
  cout << "Enter Second Number: ";
  getline (cin,mystr);
  stringstream(mystr) >> second;
  
 if (second > 180)
  {
  cout << "Too High" << endl;
  return 0;
  }
  
  missing=first+second;
  answer=triang-missing;
  
  if (answer < 0)
  {
  cout << "Whoops, looks like you've entered some bad numbers!" << endl;
  return 0;
}
  
  
  cout << "Missing Angle: " << answer << endl;
  cout << "First Number was: "<< first << endl;
  cout << "Second number was: " << second << endl;
  cout << "Answer was: " << answer << endl;
  check=answer+first+second;
  
  if (check == 180)
  {
  mnhm = 1;
  if (mnhm == 1)
  {
  cout << "Checked to see if Correct: " << "Looks Okay" <<endl;
  }
  }
  if (check < 180)
  {
  mnhm = 0;
  if (mnhm == 0)
  {
  cout << "Checked to see if Correct:" << "Whoops, seems to be wrong" <<endl;
  }
  }
  
  //int fatass = *fatss;
  //getline(fatss);
  //stringstream(fatss) >> fatass;
  //cout << "Checked to see if correct: " <<  << endl;
  return 0;

}