[Solved] Why does the program give me a different result when I use if statement [duplicate]
In an if else-if statement you put multiple conditions to evaluate the result. The following is how the statements will work in your case: if(row==1||row==n||row==2*n-1) cout<<“*”; //if true then put * or if false then move down else if (col==1&&row<n||col==n&&row>n) cout<<“*”; // if the first is false and the 2nd one is true then put … Read more