Need help optimizing a program

I've been writing a fairly simple program for the last week or so, I'm fairly new to C++ but not a complete beginner however I really need help with optimizing it. I've got the program set up to acquire various pieces of information (it's a character generator for D&D and so it needs a good deal of information such as name, class, class features, etc.). I then have it set up to output the information using the cout command. The problem is that before it's meant to output, the program crashes completely. I don't know how to optimize it to prevent this from happening and I'm all out of ideas on alternatives. Any help is much appreciated. Sorry if I come across as being a total idiot, my only experience with C++ is a book and a few online tutorials, I hope to improve soon. The code below is the output function:
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
void output() 
{ 
cout << "Character Details" << endl ; 
cout << "Name: " << name << endl ; 
cout << "Race: " << race << endl ; 
cout << "Class: " << clas << endl ; 
cout << "Hit-points: " << health << endl ; 
cout << "Healing Surges: " << healsurges << endl ; 
cout << "Surge Value: " << surgevalue << endl ; 
cout << "Feats: " << feats << endl ; 
cout << "Speed: " << speed << " squares" << endl ; 
cout << "Size: " << size << endl ; 
cout << "Alignment: " << alignment << endl ; 
cout << "Defences: " << endl ; 
cout << "AC: " << AC << endl ; 
cout << "Will: " << will << endl ; 
cout << "Reflex: " << reflex << endl ; 
cout << "Fortitude: " << fortitude << endl ; 
cout << "Strength: " << strength << "(+" << strmod << ")" << endl ; 
cout << "Dexterity: " << dexterity << "(+" << dexmod << ")" << endl ; 
cout << "Charisma: " << charisma << "(+" << charmod << ")" << endl ; 
cout << "Intelligence: " << intelligence << "(+" << intmod << ")" << endl ; 
cout << "Wisdom: " << wisdom << "(+" << wismod << ")" << endl ; 
cout << "Constitution: " << constitution << "(+" << conmod << ")" << endl ; 
cout << "Acrobatics: " << acrobatics << endl ; 
cout << "Arcana: " << arcana << endl ; 
cout << "Athletics: " << athletics << endl ; 
cout << "Bluff: " << bluff << endl ; 
cout << "Diplomacy: " << diplomacy << endl ; 
cout << "Dungeoneering: " << dungeon << endl ; 
cout << "Endurance: " << endurance << endl ; 
cout << "Heal: " << heal << endl ; 
cout << "History: " << history << endl ; 
cout << "Insight: " << insight << endl ; 
cout << "Intimidate: " << intimidate << endl ; 
cout << "Nature: " << nature << endl ; 
cout << "Perception: " << perception << endl ; 
cout << "Religion: " << religion << endl ; 
cout << "Stealth: " << stealth << endl ; 
cout << "Streetwise: " << streetwise << endl ; 
cout << "Thievery: " << thievery << endl ; 
cout << "Class and Race Features:" << endl ; 
cout << powers << endl ; 
cin >> end ; 
} 
If the program crashes before it reaches output, then the problem is elsewhere.
It crashes right before the function is supposed to run, so that's good I guess, do you have any idea where the problem could be? The program compiled fine. Is there some kind of function limit I'm not aware of?
There is no way for use to determine that as you haven't shown or told use what the problem is doing before it calls output. Try using a debugger.
please provide the entire source code
I used the debugger and got this error message:

Unhandled exception at 0x6fc5b6ca in Character1.exe: 0xC0000005: Access violation writing location 0x004093c2.

I have a feeling I may be a little out of my depth here.
@jonhy31
The source code is too big to submit, I think that may be part of the problem.
I then have it set up to output the information using the cout command.

For your information, std::cout is not a command and it's not a function. It's an output stream. Think of it as a special file mapping to the console.

The problem is that before it's meant to output, the program crashes completely. I don't know how to optimize it to prevent this from happening and I'm all out of ideas on alternatives.

Optimization is the process of improving the performance and efficiency of your program.

C++ compilers (the utilities which translate a .cpp file into an .exe file) are able to do small optimizations automatically but the major optimizations (which have to do with using the appropriate data structure and algorithms) remain the programmer's responsibility.

Long story short, optimization is not about fixing bugs.
That's the error you get when you write to an address that you haven't claimed.
@Catfish4 Thank you for clarifying, like I say, I'm pretty new to this and I'm definitely not au fait with the terminology but it's people like you that help me learn! :D

Thank you for the help in this thread, I located the problem based on some advice and fixed it, thank you!
Topic archived. No new replies allowed.