ok here`s the code

#include <iostream.h>

void main()
{
      int x = 0;

      cout << "Loliko si pa star ? >>>" ;
      cin >> x;

      if ((x >= 0 ) && ( x <= 4 ))
      {
            cout << "\n dojencek" <<endl;
              else  
//error here 
             {
                    if ( (x >= 4 ) && ( x <= 10 )
                    {
                            cout << "lohk bi se sel ucit kej" ;
                            else
                            {
                                 if ( (x >= 10 ) && ( x <= 20 )
                                         cout << "nauci se C++" ;
                                      else
                                      {
                                          if( x >= 20)
                                             cout << "zmanknjako mi je besed";
                                             cout << "nauc se C#, J++, J#";
                                          else
//error here
                                          {
                                                  cout << "you are dead" ;

                                          }
                                      }

                           }
//error here
                     }
              }
      }
  return(0);
}

but i get errors when i kompile

Get yourself a proper compiler first. That spits out an error msg when you use void main and #include iostream.h.

Few points:

  • Don't use void main( ) , use int main( ) since main always has and always will return int according to the standards.
  • Don't use old style of header inclusion i.e. the .h notation. Instead use #include <iostream> followed by using namespace std ;
  • As far as your errors are concerned, they are due to the fact that you have forgot to close your if stmts . Each if stmt must have a complementary else stmt.

What you have is

if( some_condition )
{
    // stmts 

     else
     {
      // some_stmts
      }
}

// which should actually be like:
if( some_condition )
{
      // stmts
}
else
{
     // some stmts
    
     if( another_condition )
     { }
}

But there is a better way of doing things using the else if stmts.

if( some_condition )
{
    // stmts
}
else if( another_condition )
{
    // stmts
}
else
{
    // stmts
}

I hope you catch the drift...

oh that wa s verry buggy

I solved all the problems by myself (im sory if i posted that before i checked the code)

#include <iostream.h>


using namespace std;

void main()
{
      int x = 0;

      cout << "Loliko si pa star ? >>>" ;
      cin >> x;

      if ((x >= 0 ) && ( x <= 4 ))
      {
            cout << "\n dojencek" ;
      }
              else
              {
                    if ((x >= 5 ) && ( x <= 10 ))
                    {
                            cout << "lohk bi se sel ucit kej" ;
                    }
                            else
                            {
                                 if ((x >= 10 ) && ( x <= 20 ))
                                         cout << "nauci se C++" ;
                                      else
                                      {
                                          if( x >= 20)
                                           {
                                             cout << "zmanknjako mi je besed";
                                             cout << "nauc se C#, J++, J#";
                                            }
                                          else
                                          {
                                                  cout << "you are dead" ;

                                          }


                                    }
                          }
           }

  return(0);
}

You still haven't incorporated all the changes proposed to make your program from a working program to a better or portable program....

girl? wtf?
jesus

cout << "i Am MALE"<<endl ;

:eek:

Heh...it was a Christmas joke....:D
Merry Christmas :twisted:

This question has already been answered. Start a new discussion instead.