nested if else statements

As I came across difficulty on how to write nested if else statements. Please some can help me to give a tips for that. here is the programme i wrote. but it doesnt work.


// question 1
#include <iostream>
using namespace std ;
int main()
{


int selection , rentaltype , time , week =0 , weekend ,rent , hours ;
char custom = 0 ;


cout << "enter hours , type , type simultaneously )" << endl ;
cin >> hours >> time >> rentaltype ;

if ( rentaltype == custom )
{

if ( time == week )
{
if ( hours <= 3 )
{
rent = 25 ;
cout << " rent amount is : " << rent << endl ;
}
}

}
else
cout << " get out from my house " << endl ;


return 0 ;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// question 1
#include <iostream>
using namespace std ;

int main()
{
  int selection , rentaltype , time , week =0 , weekend ,rent , hours ;
  char custom = 0 ; 

  cout << "enter hours , type , type simultaneously )" << endl ;
  cin >> hours >> time >> rentaltype ;

  if ( rentaltype == custom )
  {
    if ( time == week )
    {
      if ( hours <= 3 )
      {
        rent = 25 ;
        cout << " rent amount is : " << rent << endl ;
      }
    } 
  } else {
    cout << " get out from my house " << endl ; 
  }
  return 0 ;
}
Topic archived. No new replies allowed.