well i got some problems:
1. instead of 6 7 or 8, i get a value of minus 3 millions.
2. the money function isn't working
3. the for-loop of the program either never ends, or is only run once
4. and many more smaller problems
(sorry that all the variables have swedish names, i didn't really feel like editing 300 lines of code)
here is the code:

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <windows.h>
#include <string>
#define SND_FILENAME 0x20000
#define SND_LOOP 8
#define SND_ASYNC 1
#define SND_ALIAS 0x10000
char soundfile1[] = "C:\Documents and Settings\HP_Ägaren\Skrivbord\spel_projekt\ljud1.wav";
char soundfile2[] = "C:\Documents and Settings\HP_Ägaren\Skrivbord\spel_projekt\ljud2.wav";
char soundfile3[] = "C:\Documents and Settings\HP_Ägaren\Skrivbord\spel_projekt\ljud3.wav";
char soundfile4[] = "C:\Documents and Settings\HP_Ägaren\Skrivbord\spel_projekt\ljud4.wav";
char soundfile5[] = "C:\Documents and Settings\HP_Ägaren\Skrivbord\spel_projekt\ljud5.wav";
using namespace std;
//**************************************************************************************************************************************************
int skrivtillfil (int styrka,int hastighet, int pengar, int halsa) {
	ofstream skrivtill ("stats.txt");
	halsa = ((4*(styrka+styrka)) + (hastighet+ ((pengar*hastighet)/4))+halsa);
	skrivtill<< styrka;
	skrivtill<< ',';
	skrivtill<< hastighet;
	skrivtill<< ',';
	skrivtill<< pengar;
	skrivtill<< ',';
	skrivtill<< halsa;
	skrivtill<< ',';
	return 0;
}
//**************************************************************************************************************************************************
int duskrik (int anrop, int attack) {
	anrop = rand();
	int choice;
	if (anrop <8191) {
		cout<<"You attack the beast with ferocious power, making it scream in pain"<<endl;
		PlaySound(soundfile1,NULL,SND_FILENAME|SND_ASYNC);
	}
	if (anrop > 8191 && anrop < 16383) {
		cout<< "You unleash a hail of kicks and punches, making the beast fall over in agony"<<endl;
		PlaySound(soundfile2,NULL,SND_FILENAME|SND_ASYNC);
	}
	if (anrop > 16383 && anrop < 24573) {
		cout<< "You pull up your knife and stab the beast in its eyes, making it roar in pain"<<endl;
		PlaySound(soundfile4,NULL,SND_FILENAME|SND_ASYNC);
	}
	if (anrop >24573) {
		cout<< "The beast charges at you, but you quickly pull up your spear and repel its attack and stabbing it with your spear"<< endl;
		PlaySound(soundfile5,NULL,SND_FILENAME|SND_ASYNC);
	}
	cout<< attackedby<< "took "<< attack<< "damage"<< endl;
	cout<< "Press one to continue"<<endl;
	cin>> choice;
	if (choice != 1) {
		cout<< "Are you sure you don't want to fight, if so, press ctrl-c"<< endl;
	}
}
//**************************************************************************************************************************************************
int monsterskrik (int anrop, int attack) {
	anrop = rand();
	int choice;
	if (anrop <8191) {
		cout<<"The beast, having recovered from its stun, bites you in your leg, making you fall over"<<endl;
		PlaySound(soundfile1,NULL,SND_FILENAME|SND_ASYNC);
	}
	if (anrop > 8191 && anrop < 16383) {
		cout<< "The beast uses it's claws, giving you deep painful wounds all over your body"<<endl;
		PlaySound(soundfile2,NULL,SND_FILENAME|SND_ASYNC);
	}
	if (anrop > 16383 && anrop < 24573) {
		cout<< "You pull up your knife, preparing to go stab the beast in its eye, but "<<attackedby<< "uses his intelligence, and attack you"<<endl;
		PlaySound(soundfile4,NULL,SND_FILENAME|SND_ASYNC);
	}
	if (anrop >24573) {
		cout<< "The beast charges at you, to repel its attack you try to pull up your spear, but you are too slow and get knocked down by "<< attackedby<< endl;
		PlaySound(soundfile5,NULL,SND_FILENAME|SND_ASYNC);
	}
	cout<< "You took "<< attack<< "damage"<< endl;
	cout<< "Press one to continue"<<endl;
	cin>> choice;
	if (choice != 1) {
		cout<< "Are you sure you don't want to fight, if so, press ctrl-c"<< endl;
	}
	return anrop;
}
//**************************************************************************************************************************************************
int victorycheck1 (int halsa, bool kontroll1) {
	kontroll1 = false;
	if (halsa <= 0) {
		kontroll1 = true;
	}
	return kontroll1;
}
//**************************************************************************************************************************************************
int strid1 (int attack, int monsterhalsa) {
	monsterhalsa = (monsterhalsa - attack);
	return monsterhalsa;
}
//**************************************************************************************************************************************************
int strid2 (int halsa,int monsterattack) {
	halsa = (halsa-monsterattack);
	return halsa;
}
//**************************************************************************************************************************************************
int bonusdefine (int junk) {
	int bonusoperator;
	int bonus;
	bonusoperator = rand();
	if (bonusoperator < 10922) {
		bonus--;
	}
	if (bonusoperator > 10922 && bonusoperator < 21844) {
		//tomt
	}
	else {
		bonus++;
	}
	return bonus;
}
//**************************************************************************************************************************************************
int attackcontrol (int styrka, int hastighet, int bonus, int attack) {
	bonus = bonusdefine (styrka);
	attack = ((styrka*hastighet)+(3+bonus)+1+1);
	return attack;
}
//**************************************************************************************************************************************************
int stensaxpase (int anrop) {
	int svar;
	int val;
	int randomsvar;
	int poang = 5;
	randomsvar = rand();
	if (randomsvar < 10922) {
		svar = 1;
	}
	if (randomsvar > 10922 && randomsvar < 21844) {
		svar = 2;
	}
	else {
		svar = 3;
	}
	;
	cout<< "You unlocked the easter egg! Congratulations! This is a game of stone, bag and scissor"<<endl;
	cout<< "Press one for rock "<< endl;
	cout<<"Press two for scissor"<<endl;
	cout<<"Press three for Bag "<<endl;
	cout<<endl;
	cout<< "You got five cash, if you win you will get five more"<<endl;
	cin>> val;
	string namn;
	string namn2;
	if (val==1) {
		;
		namn = "rock";
	}
	if (val==2) {
		;
		namn = "scissor";
	}
	if (val==3) {
		;
		namn = "bag";
	}
	if (svar==1) {
		;
		namn = "scissor";
	}
	if (svar==2) {
		namn = "bag";
	}
	if (svar==3) {
		;
		namn = "rock";
	}
	if (val==svar) {
		cout<< "You Won! You chose: "<< namn2<< endl<<"The computer chose: "<< namn<<endl;
		poang = (poang + 5);
	}
	else {
		cout<< "You Lost! You chose: "<< namn2<< endl<<"The computer chose: "<< namn<<endl;
	}
	return poang;
}
//**************************************************************************************************************************************************
int main () { // definitioner
//**************************************************************************************************************************************************
	srand((unsigned)time(0));
	ifstream inst ("stats.txt");
	ifstream cheaterrr ("chheater.txt");
	ofstream chheater ("chheater.txt");
	ifstream attacking ("recentattacked.txt");
	string attackedby;
	attacking>> attackedby;
	int cheaterornot;
	int chooice;
	int unbanchoice;
	cheaterrr>> cheaterornot;
	if (cheaterornot == 1) {
		cout<< "YOU HAVE BEEN BANNED FROM THIS PROGRAM FOR CHEATING!!!!"<< endl;
		Beep (250,1000000);
	}
	else {
	int styrka;
	int hastighet;
	int pengar;
	int halsa;
	int styrkaproxy;
	int hastighetproxy;
	int pengarproxy;
	int halsaproxy;
	int choice;
	char komman [4];
	int secondcheat;
	inst>> styrkaproxy;
	inst>> komman [1];
	inst>> hastighetproxy;
	inst>> komman [2];
	inst>> pengarproxy;
	inst>> komman [3];
	inst>> halsaproxy;
	inst>> komman [4];
	halsa = halsaproxy;
	styrka = styrkaproxy;
	hastighet = hastighetproxy;
	pengar = pengarproxy;
	int bonus;
	int attack;
	int monsterhalsa = 40;
	int monsterattack = 7;
	bool kontroll = false;
	bool monsterkontroll = false;
	int anrop;
	int seconddcheat;
	//**************************************************************************************************************************************************
	 //butiken
	int gruxs;
	if (5 == 123) { // antifusk
		int cheater;
		end:;
		if (4 ==-123) {
			secondcheat:;
			cout<< "You enjoy cheating, right? Well DON'T DO IT AGAIN!"<< endl;
			cout<< "Press one to shut program down, CHEATER!"<< endl;
			cin>> seconddcheat;
			if (seconddcheat != 1) {
				ofstream chheater ("chheater.txt");
				cout<< "You are now BANNED from this program"<<endl;
				chheater<< "1";
				goto realend;
			}
			else {
				goto realend;
			}
		}
		cout<< "Press one to shut program down, CHEATER!"<< endl;
		cin>> cheater;
		if (cheater != 1) {
			goto secondcheat;
		}
		else {
			goto realend;
		}
	}
	cout<< "YE OLD TRAINING YARD"<< endl;
	if (pengar > 5) {
		cout<< "You can afford to buy two health, do you want to buy some for five cash?(Press one for yes)";
		cout<< endl;
	}
	else {
		cout<< "You can't afford to buy two health for five cash, welcome back later"<< endl;
	}
	if (pengar > 10) {
		cout<< "You can afford to buy two strenght for ten cash, do you want to do that? (Press two for yes)";
		cout<< endl;
	}
	else {
		cout<< "You can't afford to buy two strenght for ten cash"<< endl;
	}
	if (pengar > 15) {
		cout<< "You can afford to buy two agility for fifteen cash, do you want to do that? (Press three for yes)"<< endl;
	}
	else {
		cout<< "You can't afford to buy two agility for fifteen cash"<< endl;
	}
	cout<< "Press anything else then one, two and three not to buy anything at all"<< endl;
	cin>> choice;
	//**************************************************************************************************************************************************
	if (choice == 1) {
		pengar = (pengar - 5);
		halsa++;
		halsa++;
	}
	if (choice == 2) {
		pengar = (pengar - 10);
		styrka++;
		styrka++;
	}
	if (choice == 3) {
		pengar = (pengar - 5);
		hastighet++;
		hastighet++;
	}
	if (choice == 712) {
		int poang = stensaxpase(anrop);
		pengar = (pengar+poang);
	}
	else {
		cout<< "Ok, welcome back next time"<< endl;
		}
		if (pengar < 0) {
			cout<< "Bloody cheater!!!"<< endl<< "Game over!!!!"<< endl;

			gruxs = 3;
			goto end;
		}
		int i;
	//**************************************************************************************************************************************************
	// spelet
	//**************************************************************************************************************************************************
	int choice2;
	cout<< "Press 1 to fight"<< endl;
	cin>> choice2;
	if (choice2 != 1) {
		cout<< "Are you sure that you want this fight to be auto-resolved? If so, shut down by pressing ctrl-c"<< endl;
	}
	for (i=0;kontroll == false || monsterkontroll == false;i++) {
	attack = attackcontrol (styrka,hastighet,bonus,attack);
	anrop = duskrik (anrop, attack);
	anrop = 1;
	monsterhalsa = strid1 (attack, monsterhalsa);
	anrop = monsterskrik (anrop, monsterattack);
	anrop = 1;
	halsa = strid2 (halsa, monsterattack);
	kontroll = victorycheck1 (halsa, kontroll);
	monsterkontroll = victorycheck1 (monsterhalsa, monsterkontroll);
	cout<< "Your health "<< halsa<< endl<< "Opponents health "<< monsterhalsa<< endl;
	if (monsterhalsa <= 0) {
		monsterhalsa = 0;
	}
	if (halsa <= 0) {
		halsa = 0;
	}
	if (monsterhalsa == 0) {
		monsterkontroll = true;
		goto check;
	}
	if (halsa == 0) {
		kontroll = true;
		goto check;
	}
	}
	;
	//**************************************************************************************************************************************************
	check:;
	int junk;
	if (monsterkontroll == true) {
		cout<< "You won!!! You got five money!!!"<<endl;
		pengar = (pengar + 5);
		anrop = skrivtillfil (styrka, hastighet, pengar, halsa);
	}
	if (kontroll == true) {
				cout<< "You lost! No new stats will be stored!"<< endl;
	}
	}
	//**************************************************************************************************************************************************
	realend:;
	cin.get();
	return 0;
}

no answers? please help me!

I would like to help and I will as soon as you address some problems of mine:
1. Be specific about your problem. Simply saying that xyz feature does not work is not specific.
2. Post only the relevant code to your problem.
3. I understand that english is not your primary language. However if I can't read your code, I can't find the problem.
4. There are no comments in this code. Seriously!! Not one comment, not even in Swedish. What are these functions supposed to do. I have no idea.

Please reference the line numbers in that code when commenting on the code. We are not going to hunt through all that code to search for what you are talking about. For example 3. the for-loop of the program either never ends, or is only run once. Well, exactly what line do you mean ? I'm not going to manually search all 400 lines of your program to find that.

Also tell us how you tested the code. 1. instead of 6 7 or 8, i get a value of minus 3 millions. is meaningless if we don't know how you ran the program to get those numbers. But I will take a guess that there are uninitialized variables in your program which caused that error. That would be only one of several different causes.

What compiler are you using? What operating system ? Learn to use your debugger so that you can execute the program one line at a time and inspect the value of the variables at each program line execution.

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.