Hello, i'm making a form of 'Quiz' program, with a menu and a point system.
But,
my promblem is that whenever i answer a question, the answer wil allways be correct. Help me with correct this.
Also, my point system won't work, i dont know why.
FACT: I will add more questions in soon, but i just want it to work with the first 3 question, then i will add more questions to the program.
if i can't use system()
i cant stop the code runing.
How should i make a code without that?
I have made a simple one before.
Then i made a new simple one and started
to build it bigger and bigger, with ALOT more
details.
I did'nt post you this Definers.h
#include <iostream>
#include <Windows.h>
#include <ctime>
#include <time.h>
#include <math.h>
#include <string>
#define VK_C 0x43
#define EXITCONDITION 42
usingnamespace std;
//Default
int UserGuess;
int answer;
int Points;
//Categorys
int CatKon;
int CatRoom;
int CatBath;
int CatNers;
int CatLiv;
int Bodil;
char CharAnswer;
int CatKonPoints;
ok you should not be using the .h version of these header files. So use <cmath> and <ctime> inplace of <math.h> and <time.h> in future. You also don't use any function from <math>, so you can get actually rid of that and since we're not using system(), you can get rid of <windows.h> too.
You should be declaring your variables inside the function that is using them, not globally as you have done here.
Also, using namespace std; is not good practice. You should either type std::whatever as I have done in my example or type using for only what you are actually using, which in your case thus far would be.
1 2 3
using std::cin;
using std::cout;
using std::string;
You might question my points in this post, but believe me, follow them now, from right now, rather than getting used to bad habits and suffering badly further down the line when everything starts going wrong.