Im new in C++

im just wondering

how to use two if statement with else in the same source project

because when im doing it the part 2 else go together with else1

The if/else construct is as follows:

if (condition) {
   // body of if
}

// ---- 

if (condition) {
   // body of if
} else {
   // body of unconditional else
}

// ----

if (condition1) {
   // body of if
} else if (condition2) {
   // body of else if
} else {
   // body of unconditional else
}

You can certainly insert an if into one of those bodies similar to

if (condition) {
   if (some_other_condition) {
      // body of inner if
   } else {
      // body of unconditional else of inner if
   }
} else {
   // body of unconditional else of outer if
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.