vendredi 21 août 2015

Need Help in C++

Hello Everyone i am new to c++.I use Dev-C++5.11 as my compiler.I have created a simple area finder application.The Code is attached below

#include <iostream>
#include<conio.h>
using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
  int a,b,l,r,i;
  cout<<"Type 1 For The Area of Circle. Type 2 For the Area of Rectangle";
  cin>>i;
  if(i<2)
  {
      cout<<"Type In the Radius of the Circle";
      cin>>r;
      cout<<"The Radius of the Circle is:"<<3.14*(r*r);
  }
  else
  {
      cout<<"Type In the  Lenght of the Rectangle";
      cin>>l;
      cout<<"Type In the Breadth of the Rectangle";
      cin>>b;
      a=l*b;
      cout<<"The Area of The Rectangle is :"<<a;              
  }
  return 0;
}

The App works fine when inputting something, But it crashes when it is time to display the area.Please help me solve this problem :)

Aucun commentaire:

Enregistrer un commentaire