How to make these if statements look nicer?

Hello I've been programming for about a year and abit and I'm starting to look at my code from a visual standpoint and was wondering how I could make this code below look alot more cleaner and nicer

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
using namespace std;



int main()
{

	bool 

	player = true,
	notplayer = true;


	int 

        rect = 0,
	enemy = 1;
	

	if(player == true)
	{ 
           cout << "Tarts";
                   
              if(rect == 0)
	       {
		   cout << "Blah Blah" << endl ;
	       }

	}

	 if(notplayer == true)
	 {
	    cout << "Tarts" << endl;
	 }


	        if(enemy >= 1)
	        {
	   	    cout << "Tarts" << endl;
	        } 

	
}
Last edited on
Don't put so many blank lines in your code? Also:
1
2
3
4
5
6
7
bool 

	player = true,
	notplayer = true;
//Looks really confusing.
//Why not just write:
bool player = true, notplayer = true; //? 
if(player)
¿What the hell is 'notplayer'? notplayer != not player ¡¿?!
closed account (zb0S216C)
I agree with BlackSheep; there's just too much white-space. Personally, when working with integers (when integers represent something), I tend to use a switch. Comments wouldn't hurt either; I don't even know what your code is supposed to do.

Wazzak
Your names are confusing, and if(player==true) is redundant. Just write if(player).
Topic archived. No new replies allowed.