Oct 6, 2013 at 5:28am Oct 6, 2013 at 5:28am UTC
Hey ,i'm a beginner and just start study C++ in few month. Why my coding wont run in CodeBlock but work in Dev C++. Your help would we very appreciated :)
#include <iostream>
using namespace std;
int kira(int,int);
int main()
{
int l,w;
cout<<"Enter length :";
cin>>l;
cout<<"Enter width :";
cin>>w;
cout<<"Area of rectangle is :"<<kira(l,w)<<endl;
system ("pause");
return 0;
}
int kira(int length , int width)
{
int area;
area=length*width;
return area;
}
Oct 6, 2013 at 5:37am Oct 6, 2013 at 5:37am UTC
system is not required to be defined by iostream.
I believe cstdlib is the header file you need for system.
Oct 6, 2013 at 5:53am Oct 6, 2013 at 5:53am UTC
Thanks firedraco. Now it worked.
I deleted => system ("pause"); .
Still wondering why it work after I deleted it , hurmmm.
Oct 6, 2013 at 6:02am Oct 6, 2013 at 6:02am UTC
ooh , and cstdlib doesn't work