'debug assertion failed! invalid null pointer' cant get the damn thing working

closed account (L3ApfSEw)
I'm using Microsoft Visual C++ 2010 Express
I don't know much about coding, lol I started learning C++ just a few days ago.
Here's my code (i dont care about my grammar errors or other weirdnesses :D)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;

int main(){
	system("color c");
	cout << "Hello\nThis program will tell you everything about your looks. Just answer all these questions and you'll get the answers. Go!";
	int hot = 0;
	cout << "Are you a girl ('g') or a boy ('b')?\nInput: ";
	string gb = 0;
	cin >> gb;
	system("cls");


	while(gb == "g"){ ////////////////////////////////// gurlz
		// kitxva nomeri erti
		cout << "OK, girl...\nLet's check wheter you are obesse or not. Please input your weight (kg): ";
		int weight = 0;
		cin >> weight;
		system("cls");
		if(weight <= 75){ // roca ar aris msukani
			cout << "Seems like your weight is OK! Wonderful!";
			hot = hot + 1;
			getch();
		}
		if(weight >= 85){ // roca msukania
			cout << "Seems like you've got some problems with your weight... Sad, but that's OK! Let's move on!";
			hot = hot - 2;
			getch();
		}

		 
		// kitxvis dasasruli
		system("cls");
		// kitxva nomeri ori
		char acne;
		int acne2;
		cout << "Let's check your skin condition. Do you have lots of acnes on your face? [y - yes/n - no]: ";
		cin >> acne;
		string function;
		system("cls");
		if(function == "y")
			acne2 = 1;
		if(function == "n")
			acne2 = 0;
		if(acne2 == 0){
			cout << "So you do not have any skin condition, do you... Great! Let's move on.";
			hot = hot + 1;
			getch();
		}
		if(acne2 == 1){
			cout << "Having acne is really bad, but there are lots of ways of removing them! Don't worry, let's just move on.";
			hot = hot - 2;
			getch;
		}
		// kitxvis dasasruli
		system("cls");
		// mesame kitxva
		float height;
		cout << "Let's check how tall you are. Input your height (in meters, e.g. '1.8': ";
		cin >> height;
		system("cls");
		if(height <= 1.75 && weight >= 70){
			cout << "Your weight is really big for your height. That's bad, you should put yourself on a rigorous diet!";
			hot = hot - 2;
			getch();
		}
		if(height <= 1.75 && weight <= 70){
			cout << "You aren't very high :( Your weight is OK for your height too, so you don't have to be sad about it ;)";
			hot = hot + 1;
			getch();
		}
		if(height >= 1.75 && weight <= 70){
			cout << "Your height is really impressive and your weight is good for that height as well! You are a happy one! :)";
			hot = hot + 2;
			getch();
		}
		if(height >= 1.75 && weight >= 70){
			cout << "You height is OK and your weight isn't that bad for your height as well. There's nothing to worry about :)!";
			hot = hot + 1;
			getch();
		}
		
	} //////////////////////////////// end of gurlz

	while(gb == "b"){ ////////////////////////// boyz
		cout << "This 'while' loop is for 'b' cycle (boys)\nUNDER FUCKING CONSTRUCTION!";
		getch();
	} ///////////////////////////// end of boyz
	system("cls");
	if(hot <= 2)
		cout << "Maybe you aren't as good looking as you would've wanted to, but you can totally fix that! Work out, live a healthy life, always shave, stay hygienic and see a plastic surgeon! Remember, being good looking is just one of the factors of rating a peson's character.\nBy the way, you scored '" << hot << "'. Good luck!";
	if(hot > 2)
		cout << "Wow, you must be pretty good looking! Being good looking always gives person the feel of confidence, which is one of the most important things about his/her character! Remember, being good looking is not enough for a success in your life.\nBy the way, you scored '" << hot << "'. Good luck!";
	return 0;
}


It let's me compile and build solution without any problems, but when I start debugging it, this window pops out and stops the program:
http://i.imgur.com/pqW2w.jpg

My question: What is the cause of this error?
Last edited on
string gb = 0; makes no sense. Try
string gb;
You never assign a value to "function" string, but later you compare with another string, resulting in logical errors (at least).
Topic archived. No new replies allowed.