Re: [Dev-C++] you will never belive this
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Josh M. <mrl...@gm...> - 2006-06-17 14:58:50
|
First off, C++ doesn't use .h headers anymore. You want <iostream>, and
then you need to either replace cout with std::cout, and endl with
std::endl, or else you need to add a "using namespace std;" line after the
#include line.
And please please please don't call main() recursively, that's just asking
for trouble. Use an infinite loop and break out of it instead.
On 6/17/06, Eric Richards <eri...@cl...> wrote:
>
> Some months ago I did a google search on logic gates and found lots of
> errors out there on the web, so I thought I would make my own page
> (without
> errors), then just because I thought it would be interesting thought I
> would
> have a bit of code to do the same thing as logic gate, here is the code
> below,
>
> The strange thing was it worked first in version 4.9.9.1 then it stopped
> working and refused to compile and run. Then I put the same code into
> version 4.9.9.0 and it worked again.
>
> I tried to get the BOOL to work in place of INT but I did not have much
> luck, (that was when version 4.9.9.1 stopped working) then I thought I
> wonder if I could get the code to throw a exception error if you enter a
> number other than 0 or 1 so the DOS type screen shuts off after doing a
> return 0;
>
>
>
>
>
> #include <iostream.h>
> int in_A;
> int in_B;
>
> int main ()
> {
>
>
> cout << "input Gate A, enter 1 or 0, enter 2 to end program" << " "
> ;
> cin >> in_A ;
>
> cout << "input Gate B, enter 1 or 0, enter 2 to end program" << " "
> ;
> cin >> in_B ;
> if (in_A==2 || in_B==2)
> {
> return 0;
> }
>
>
> if (in_A==1&& in_B==1)
> {
> cout << endl << "Output is logic one" << endl ;
> }
> else
> {
> cout << endl << "Output is logic zerro" << endl ;
> }
> system("PAUSE");
> main();
>
>
> }
>
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
--
Cheers,
Josh
PGP: http://revvy.box43.net/Josh_Matthews.asc
|