function isn't printing my array

hi im making a calculator and now i wan't it to save the 10 last calculations in an array, i can compile it but for some reason i won't print them out when im pressing "5" which should call that function. let me know if i should translate it or light up anything
#include "regne.h"
#include <iostream>
 
using namespace std;
 
 
 
int main() {
    int valg;
    float _valgt = (float) valg;
    float tal_1 = 0;
    float tal_2 = 0;
    float resultat = 0;
    int i = 0;
    int ab = 0;
    
 
    cout<< "velkommen til lommeregneren, hvad kunne du tænke dig at gøre?"<<endl<<endl;
 
 
    
    for(int i = 0; i<12; i++)
    {
    cout<< "for plus tryk 1, for minus tryk 2, for gange tryk 3, for dividere tryk 4. Hvis du vil se det gemte tryk 5, eller luk ved at trykke 6"<<endl;
    cin>>valg; 
    
    if(valg == 1){//plus
   
    cout<< "indtast venligst nummer 1: "; cin>>tal_1;
    cout<< "indtast venligst nummer 2: "; cin>>tal_2;
         resultat = _plus(tal_1,tal_2);
        }
    else if(valg == 2){//minus
    cout<< "indtast venligst nummer 1: "; cin>>tal_1;
    cout<< "indtast venligst nummer 2: "; cin>>tal_2;         
         resultat = _minus(tal_1,tal_2);
         }
    else if(valg == 3){//gange
    cout<< "indtast venligst nummer 1: "; cin>>tal_1;
    cout<< "indtast venligst nummer 2: "; cin>>tal_2;
         resultat = _gange(tal_1,tal_2);
         }
    else if(valg == 4){//dividere
    cout<< "indtast venligst nummer 1: "; cin>>tal_1;
    cout<< "indtast venligst nummer 2: "; cin>>tal_2;         
         resultat = _dividere(tal_1,tal_2);
         }
    else if(valg == 5){
    _gemme(_valgt);    
}
    else {//lukke
         return 0;
         }
         }
 
 
 
cin.get();
cin.get();
return 0;
}
    
float _plus(float &a, float &b)
{
      float plus_1;
      plus_1 = a+b;
      cout<<a<<"+"<<b<<"="<<plus_1<<endl;
      _gemme(plus_1);
      cout<<"gemt"<<endl<<endl;
}
 
float _minus(float &a, float &b)
{
      float minus_1;
      minus_1 = a-b;
      cout<<a<<"-"<<b<<"="<<minus_1<<endl<<endl;
}
 
float _gange(float &a, float &b)
{
      float gange_1;
      gange_1 = a*b;
      cout<<a<<"*"<<b<<"="<<gange_1<<endl<<endl;
}
 
float _dividere(float &a, float &b)
{
      float div_1;
      div_1 = a/b;
      cout<<a<<"/"<<b<<"="<<div_1<<endl<<endl;
}
 
float _gemme (float &resultat)
{   
    int valg;
    resultat = valg;  
               
      
      if(valg!=5)
      {
                 for(int i=0; i<10; i++)
                 {
                         if(i<10)
                         {
                                 gemt[i] = resultat;
                         }
                         else
                         {
                             cout<<"kan ikke gemme flere resultater"<<endl;
                         }
                 }
                 }
                 else
                 {
                     for(int i = 0; i<10; i++)
                     {
                             cout<<gemt[i];
                     }
                 
      
}
}
 
 
 
//and this is my headerfile "regne.h"
 
float _plus (float &a, float &b);
float _minus(float &a, float &b);
float _gange(float &a, float &b);
float _dividere(float &a, float &b);
float _gemme (float &resultat);
float gemt[10];

Open in new window

LVL 1
smurf_killerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cupCommented:
Try cout.flush () after the cout << statement where you want the number to display.
0
smurf_killerAuthor Commented:
it still wont show it :S
0
SwissKnifeCommented:
Hello
You have declared a local variable valg in the function _gemme. The if test the uninitalized value of the local variable. You have to declare the variable valg at file scope (at the top of the file outside the main function) to use it, or use another parameter to the _gemme function with value of valg.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

smurf_killerAuthor Commented:
thanks that sounds reasonable, ill try it and get back
0
evilrixSenior Software Engineer (Avast)Commented:
You have a few issues here. Find observations on the most obvious inline as comments in the source below.
#include "regne.h"
#include <iostream>
 
using namespace std;
 
int main() {
	int valg;
	// RX: The line below: leading underscore is reserved for implementation use by the C++ standard, don't use leading underscore variable names
	float _valgt = (float) valg; // RX: What is th epoint of this when valg has no defined value? Also, this style of cast is deprecated, use static_cast
	float tal_1 = 0;
	float tal_2 = 0;
	float resultat = 0;
	int i = 0;
	int ab = 0;
 
 
	cout<< "velkommen til lommeregneren, hvad kunne du tænke dig at gøre?"<<endl<<endl;
 
 
 
	for(int i = 0; i<12; i++)
	{
		cout<< "for plus tryk 1, for minus tryk 2, for gange tryk 3, for dividere tryk 4. Hvis du vil se det gemte tryk 5, eller luk ved at trykke 6"<<endl;
		cin>>valg; 
 
		if(valg == 1){//plus  // RX: What 's wrong with using a switch/case construct?
 
			cout<< "indtast venligst nummer 1: "; cin>>tal_1;
			cout<< "indtast venligst nummer 2: "; cin>>tal_2;
			resultat = _plus(tal_1,tal_2);
		}
		else if(valg == 2){//minus
			cout<< "indtast venligst nummer 1: "; cin>>tal_1;
			cout<< "indtast venligst nummer 2: "; cin>>tal_2;         
			resultat = _minus(tal_1,tal_2);
		}
		else if(valg == 3){//gange
			cout<< "indtast venligst nummer 1: "; cin>>tal_1;
			cout<< "indtast venligst nummer 2: "; cin>>tal_2;
			resultat = _gange(tal_1,tal_2);
		}
		else if(valg == 4){//dividere
			cout<< "indtast venligst nummer 1: "; cin>>tal_1;
			cout<< "indtast venligst nummer 2: "; cin>>tal_2;         
			resultat = _dividere(tal_1,tal_2);
		}
		else if(valg == 5){
			_gemme(_valgt);    
		}
		else {//lukke
			return 0;
		}
	}
 
 
 
	cin.get();
	cin.get();
	return 0;
}
 
float _plus(float &a, float &b) // RX: This is meant to return something, no?
{
	float plus_1;
	plus_1 = a+b;
	cout<<a<<"+"<<b<<"="<<plus_1<<endl;
	_gemme(plus_1);
	cout<<"gemt"<<endl<<endl;
}
 
float _minus(float &a, float &b) // RX: This is meant to return something, no?
{
	float minus_1;
	minus_1 = a-b;
	cout<<a<<"-"<<b<<"="<<minus_1<<endl<<endl;
}
 
float _gange(float &a, float &b) // RX: This is meant to return something, no?
{
	float gange_1;
	gange_1 = a*b;
	cout<<a<<"*"<<b<<"="<<gange_1<<endl<<endl;
}
 
float _dividere(float &a, float &b) // RX: This is meant to return something, no?
{
	float div_1;
	div_1 = a/b;
	cout<<a<<"/"<<b<<"="<<div_1<<endl<<endl;
}
 
float _gemme (float &resultat) // RX: This is meant to return something, no?
{   
	int valg;
	resultat = valg;  // RX: Why does this achieve? valg is an undefined variable
 
 
	if(valg!=5) // RX: valg isn't initialized, this does nothing useful
	{
		for(int i=0; i<10; i++)
		{
			if(i<10)
			{
				gemt[i] = resultat;
			}
			else
			{
				cout<<"kan ikke gemme flere resultater"<<endl;
			}
		}
	}
	else
	{
		for(int i = 0; i<10; i++)
		{
			cout<<gemt[i];
		}
 
 
	}
}
 
 
 
//and this is my headerfile "regne.h"
 
float _plus (float &a, float &b); // RX: Passing floats (or any intrinsic) as references is likely to be less efficient than by value
float _minus(float &a, float &b); // RX: If you are going to use references consider making them const
float _gange(float &a, float &b);
float _dividere(float &a, float &b);
float _gemme (float &resultat);
float gemt[10]; // RX: Globals are bad practice, don't use them as they force tight coupling

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Infinity08Commented:
You have to always keep in mind the scope of variables. When you declare a variable, its scope will be until the end of the enclosing block. That variable will NOT be visible anywhere else in the code, including other functions.

For example :

        void fun() {
            // val is NOT visible here !!!
        }

        void fun2() {
            int val;        // <--- the scope of val is the fun2 function
            fun();
        }
0
smurf_killerAuthor Commented:
sorry for the late answer but my internet was down. ive tried what you said but it still wont work, this is my code now.
#include "regne.h"
#include <iostream>
 
using namespace std;
 
 
int valg;
float valgt = static_cast<float>(valg);
int main() {
    
    float tal_1 = 0;
    float tal_2 = 0;
    float resultat = 0;
    int i = 0;
    int ab = 0;
    
 
    cout<< "velkommen til lommeregneren, hvad kunne du tænke dig at gøre?"<<endl<<endl;
 
 
    
    for(int i = 0; i<12; i++)
    {
    cout<< "for plus tryk 1, for minus tryk 2, for gange tryk 3, for dividere tryk 4. Hvis du vil se det gemte tryk 5, eller luk ved at trykke 6"<<endl;
    cin>>valg; 
    
    if(valg == 1){//plus
   
    cout<< "indtast venligst nummer 1: "; cin>>tal_1;
    cout<< "indtast venligst nummer 2: "; cin>>tal_2;
         resultat = _plus(tal_1,tal_2);
        }
    else if(valg == 2){//minus
    cout<< "indtast venligst nummer 1: "; cin>>tal_1;
    cout<< "indtast venligst nummer 2: "; cin>>tal_2;         
         resultat = _minus(tal_1,tal_2);
         }
    else if(valg == 3){//gange
    cout<< "indtast venligst nummer 1: "; cin>>tal_1;
    cout<< "indtast venligst nummer 2: "; cin>>tal_2;
         resultat = _gange(tal_1,tal_2);
         }
    else if(valg == 4){//dividere
    cout<< "indtast venligst nummer 1: "; cin>>tal_1;
    cout<< "indtast venligst nummer 2: "; cin>>tal_2;         
         resultat = _dividere(tal_1,tal_2);
         }
    else if(valg == 5){
    _gemme(valgt);    
}
    else {//lukke
         return 0;
         }
         }
 
 
 
cin.get();
cin.get();
return 0;
}
    
float _plus(float &a, float &b)
{
      float plus_1;
      plus_1 = a+b;
      cout<<a<<"+"<<b<<"="<<plus_1<<endl;
      _gemme(plus_1);
      cout<<"gemt"<<endl<<endl;
}
 
float _minus(float &a, float &b)
{
      float minus_1;
      minus_1 = a-b;
      cout<<a<<"-"<<b<<"="<<minus_1<<endl<<endl;
}
 
float _gange(float &a, float &b)
{
      float gange_1;
      gange_1 = a*b;
      cout<<a<<"*"<<b<<"="<<gange_1<<endl<<endl;
}
 
float _dividere(float &a, float &b)
{
      float div_1;
      div_1 = a/b;
      cout<<a<<"/"<<b<<"="<<div_1<<endl<<endl;
}
 
float _gemme (float &resultat)
{   
 
      
               
      
      if(valgt!=5)
      {
                 for(int i=0; i<10; i++)
                 {
                         if(i<10)
                         {
                                 gemt[i] = resultat;
                         }
                         else
                         {
                             cout<<"kan ikke gemme flere resultater"<<endl;
                         }
                 }
                 }
                 else
                 {
                     for(int i = 0; i<10; i++)
                     {
                             cout<<gemt[i];
                             cout.flush();
                     }
                 
      
}
}

Open in new window

0
evilrixSenior Software Engineer (Avast)Commented:
>> ive tried what you said but it still wont work
It would help if you provided more information about what doesn't work.

Did you review the comments I made inline in your code? You seemed to have overlooked some of them. Again, I've added inline comments to your code. Can I suggest you read through them carefully and any you don't understand feel free to ask for additional info here?

-Rx.
#include "regne.h"
#include <iostream>
 
using namespace std;
 
 
// RX: <--- [ You still have unnecesary file scoped variables ]
int valg;
float valgt = static_cast<float>(valg); // RX: <--- [ Why not just initialize this with 0.0? BTW: globals are always set to 0 by default ]
 
int main() {
 
	float tal_1 = 0;
	float tal_2 = 0;
	float resultat = 0;
	int i = 0;
	int ab = 0;
 
 
	cout<< "velkommen til lommeregneren, hvad kunne du tænke dig at gøre?"<<endl<<endl;
 
 
 
	for(int i = 0; i<12; i++)
	{
		cout<< "for plus tryk 1, for minus tryk 2, for gange tryk 3, for dividere tryk 4. Hvis du vil se det gemte tryk 5, eller luk ved at trykke 6"<<endl;
		cin>>valg; 
 
		if(valg == 1){//plus // RX: <--- [ Use a switch/case, it'll be simpler ]
 
			cout<< "indtast venligst nummer 1: "; cin>>tal_1;
			cout<< "indtast venligst nummer 2: "; cin>>tal_2;
			resultat = _plus(tal_1,tal_2); // RX: <--- [ You don't do anything with resultant ]
		}
		else if(valg == 2){//minus
			cout<< "indtast venligst nummer 1: "; cin>>tal_1;
			cout<< "indtast venligst nummer 2: "; cin>>tal_2;         
			resultat = _minus(tal_1,tal_2); // RX: <--- [ You don't do anything with resultant ]
		}
		else if(valg == 3){//gange
			cout<< "indtast venligst nummer 1: "; cin>>tal_1;
			cout<< "indtast venligst nummer 2: "; cin>>tal_2;
			resultat = _gange(tal_1,tal_2); // RX: <--- [ You don't do anything with resultant ]
		}
		else if(valg == 4){//dividere
			cout<< "indtast venligst nummer 1: "; cin>>tal_1;
			cout<< "indtast venligst nummer 2: "; cin>>tal_2;         
			resultat = _dividere(tal_1,tal_2); // RX: <--- [ You don't do anything with resultant ]
		}
		else if(valg == 5){
			_gemme(valgt);    
		}
		else {//lukke
			return 0;
		}
	}
 
 
 
	cin.get();
	cin.get();
	return 0;
}
 
float _plus(float &a, float &b)
{
	float plus_1; // RX: <--- [ Why not initialize it when you define it? ]
	plus_1 = a+b;
	cout<<a<<"+"<<b<<"="<<plus_1<<endl;
	_gemme(plus_1);
	cout<<"gemt"<<endl<<endl;
 
	// RX: <--- [ Return value? ]
}
 
float _minus(float &a, float &b)
{
	float minus_1; // RX: <--- [ Why not initialize it when you define it? ]
	minus_1 = a-b;
	cout<<a<<"-"<<b<<"="<<minus_1<<endl<<endl;
 
	// RX: <--- [ Return value? ]
}
 
float _gange(float &a, float &b)
{
	float gange_1; // RX: <--- [ Why not initialize it when you define it? ]
	gange_1 = a*b;
	cout<<a<<"*"<<b<<"="<<gange_1<<endl<<endl;
 
	// RX: <--- [ Return value? ]
}
 
float _dividere(float &a, float &b)
{
	float div_1; // RX: <--- [ Why not initialize it when you define it? ]
	div_1 = a/b;
	cout<<a<<"/"<<b<<"="<<div_1<<endl<<endl;
 
	// RX: <--- [ Return value? ]
}
 
float _gemme (float &resultat)
{   
	if(valgt!=5) // RX: <--- [ This should have been passed into the function, not gloabl ]
	{
		for(int i=0; i<10; i++)
		{
			if(i<10)
			{
				gemt[i] = resultat; // RX: <--- [ Where is gemt defined? ]
			}
			else
			{
				cout<<"kan ikke gemme flere resultater"<<endl;
			}
		}
	}
	else
	{
		for(int i = 0; i<10; i++)
		{
			cout<<gemt[i]; // RX: <--- [ Where is gemt defined? ]
			cout.flush();
		}
	}
 
	// RX: <--- [ Return value? ]
}

Open in new window

0
smurf_killerAuthor Commented:
i have corrected those you have pointed out to me, ill fix the if() to switch later. but im rather unsure about your 2 first comments, as im not quite sure what you mean. and also, my array and my functions is all defined in a header file, thats what my book tells me and actually it works for me.

but i think ive narrowed it down to the "valgt" variable, it doesn't seem to get the value of "valg", do you have any idea why that is? i tried cout it in my function where i need it but its just 0, so that must be the reason why it never gets into the if loop. also im not quite sure why the function "_gemme" should return something as you say, is it because it isn't void?
0
Infinity08Commented:
>> but i think ive narrowed it down to the "valgt" variable, it doesn't seem to get the value of "valg",

That's because you never set the valgt variable. You just initialize it at the start of the program here :

        int valg;
        float valgt = static_cast<float>(valg);

So, it will contain the value 0.0

After that you never modify it, so for the whole duration of the program, it will have that value 0.0

As I said earlier : scope, scope and scope. Keep track of which variable you want to change where, and whether the scope of the variable allows you to do that.
0
evilrixSenior Software Engineer (Avast)Commented:
>> scope, scope and scope
And keep the scope of variables to only the place you need them. Declaring global variables makes development and maintenance problematic. It would be better to define your two globals in main and then pass them to the functions that need them. Since you are using C++ you can pass them by reference to the cost is low and the semantics of use would be as though they were local variables. If your book is telling you to use global variables I'd consider getting a new book!

http://c2.com/cgi/wiki?GlobalVariablesAreBad
0
Infinity08Commented:
>> If your book is telling you to use global variables I'd consider getting a new book!

Especially if it says to define them in a header file :)
0
evilrixSenior Software Engineer (Avast)Commented:
>> the semantics of use would be as though they were local variables
I should probably clarify that statement. I meant the usage semantics, ie you don't need to handle them as a pointer, rather you can use object semantics (valg= 0 ratehr than *pvalg = 0). You should note though that since they are passed by reference any changes will still be visible to all places they are referenced -- which is what you want, right?
0
evilrixSenior Software Engineer (Avast)Commented:
>> Especially if it says to define them in a header file :)
Good point, as this will break the one definition rule.
http://en.wikipedia.org/wiki/One_Definition_Rule
0
smurf_killerAuthor Commented:
but they are in the global scope, so in that way they should be accesible anywhere? but if i say valgt = valg; then it would just come up with an error that it can't convert a int to float?
0
smurf_killerAuthor Commented:
well i tried to do it with a reference, as shown in my first code, but that didn't work either
0
Infinity08Commented:
>> but if i say valgt = valg; then it would just come up with an error that it can't convert a int to float?

        valgt = static_cast<float>(valg);
0
evilrixSenior Software Engineer (Avast)Commented:
I'd question the validity of this cast though, since you could just do...

int valg = 0;
float valgt  = 0.0;
0
evilrixSenior Software Engineer (Avast)Commented:
Strictly speaking it should be float valgt  = 0.0f; to indicate it's a float and not a double; however, most compilers won't complain about this (VC 2005 doesn't).
0
Infinity08Commented:
>> well i tried to do it with a reference, as shown in my first code, but that didn't work either

In your first code, you had this (kept just the relevant code) :


int main() {
    int valg;                     // <--- valg has an undefined value here
    float valgt = (float) valg;   // <--- valgt now has that same undefined value, but cast to a float
    
    cin >> valg;                  // <--- now valg contains the value given by the user
 
    if (valg == 5) {
      gemme(valgt);               // <--- valgt still has an undefined value, and that's the value passed to gemme()
    }
 
    return 0;
} 
 
 
float gemme (float &resultat) {   // <--- resultat is a reference to valgt (which still contains the undefined value)
    int valg;                     // <--- this is a local valg (different from the one in main !!!). Again it has an undefined value
    resultat = valg;              // <--- now, that new undefined value is assigned to resultat (and thus to the valgt in main)
               
    if (valg != 5) {              // <--- this will probably NOT be true, as valg has an undefined value
        // <SNIP>
    }
    else {
        // <SNIP>
    }
}

Open in new window

0
Infinity08Commented:
>> I'd question the validity of this cast though

It is valid like this :

        cin >> valg;
        valgt = static_cast<float>(valg);
0
evilrixSenior Software Engineer (Avast)Commented:
Return value?
0
smurf_killerAuthor Commented:
infinity, thats what ive already done, but should they be in my main() instead?

evilrix: the problem is that i need the value from valg, and as "_gemme" is a float i can't use it there as a reference. if that was what you ment though
0
Infinity08Commented:
>> infinity, thats what ive already done, but should they be in my main() instead?

No you haven't. Did you understand the comments I added to your code in my previous post ?
0
evilrixSenior Software Engineer (Avast)Commented:
>> It is valid like this

My point was, I'm unclear as the whole point of mixing int and float in the way it's being done here. The only place there needs to be a conversion is in the functions that do arithmetic with the int values that could, potentially, result in a float. There seems to be an eclectic mix going on here that doesn't make much sense.

>> the problem is that i need the value from valg, and as "_gemme" is a float i can't use it there as a reference. if that was what you ment though

Why not?
0
Infinity08Commented:
>> My point was,

Yep. I agree.

smurf_killer, this is code for an assignment/exercise if I understood it well. Can you post the exact assignment ?
0
evilrixSenior Software Engineer (Avast)Commented:
>> Yep. I agree.
That's good, I thought I'd overlooked something :)
0
smurf_killerAuthor Commented:
now i actually got it to work thanks, the hole problem was where i had put the static cast. but now i just cout's out all 10. but ill open a new question for that if i can't find the problem

but thanks for your help all of you, much appreciated
0
Infinity08Commented:
I also suggest reading these tutorials in order to get a better understanding :

        1) variables : http://www.cplusplus.com/doc/tutorial/variables.html
                especially the paragraphs about scope and initialization

        2) functions : http://www.cplusplus.com/doc/tutorial/functions.html
                especially the part about passing arguments, and their scope
0
smurf_killerAuthor Commented:
thanks ill do that
0
Infinity08Commented:
May I ask for the reason for the B grade ? That usually means that there was something missing in our answers. If so, can you explain what ? Note also that you can always ask for clarification if something requires further explanation.
0
evilrixSenior Software Engineer (Avast)Commented:
Um, I'd pointed out the need to use static_cast a couple of times before the actual accepted answer! This being the case I am wondering why this wasn't at least a point split!

http:#20807289
http:#20810037
0
evilrixSenior Software Engineer (Avast)Commented:
>> May I ask for the reason for the B grade ? That usually means that there was something missing in our answers.
Two experts put a lot of effort into assisting with this question and, to be honest, I don't think neither the answer selected nor the grade given reflect this. There are many things wrong with the code posted, the accepted answer only identified one of these, many others were pointed out in various posts from both experts. This being the case I have requested a moderator review this thread to provide objective clarity.
0
Infinity08Commented:
>> the hole problem was where i had put the static cast.

Did you move it after the cin >> valg; ? Like I posted in my post with id 20813380 ?

If so, then that's good, but it's only one of the problems with your code as evilrix pointed out.

This thread contains a LOT of good information that will help you fix the code. You just have to read through it all, and every time something isn't clear, ask about it.
0
evilrixSenior Software Engineer (Avast)Commented:
>> If so, then that's good, but it's only one of the problems with your code as evilrix pointed out.
This was the last part of a big jigsaw, but the selected answer only reflects this last part and not the effort put into helping you solve the rest of it. Anyway, I'll let a moderator decide the closure of this Q is appropriate or not. Other than that, I'm glad you managed to get it working.

-Rx.
0
smurf_killerAuthor Commented:
i was thinking alot about how to close this question, and i was very unsure, but in the end, that was the problem
0
smurf_killerAuthor Commented:
also, i will admit that the points were given out incororectly, and also the grade. but in the time i thought that it was the right one. i hope that the moderator can split them out more evenly
0
evilrixSenior Software Engineer (Avast)Commented:
>> but in the end, that was the problem
There were many problems, lots of which would mean the code wouldn't even have built. The fact that you modified you code in-between posts after following out advice serves to confirm that assertion. Look back through the posts, there were many issues pointed out, all of which would have prevented your code from working.

The answer you selected was just the last problem you needed to solve so of course that was the one that finally solved the problem for you but without the other issues being pointed out that wouldn't have helped you either!
0
Infinity08Commented:
Do you understand that that's not the only problem ?

Can you explain the B grade ?
0
smurf_killerAuthor Commented:
sorry infinity i can't really explain it. as i said in the precious post in felt right in the moment, but now i see it was wrong. i hope a moderator maybe can correct it
0
evilrixSenior Software Engineer (Avast)Commented:
>> sorry infinity i can't really explain it. as i said in the precious post in felt right in the moment, but now i see it was wrong. i hope a moderator maybe can correct it

No worries. A moderator will be happy to review and, if they deem appropriate, reopen the Q.
0
smurf_killerAuthor Commented:
great, im still quite new to this community i.e. haven't used it so much so im not used to accept multiple answers
0
Infinity08Commented:
fyi :

        How do I close a question : http://www.experts-exchange.com/help.jsp#hi331
0
evilrixSenior Software Engineer (Avast)Commented:
>> great, im still quite new to this community i.e. haven't used it so much so im not used to accept multiple answers
No worries. Normally I'd accept the answer selected but on this occasion I just didn't feel it did I8 or myself justice. We put a lot of effort and care into trying to provide help, all we ask is the same effort is put into closing the Q: -

a) To show appreciation for our assistance
b) To ensure anyone else who finds this Q can see what the correct answer actually was.

Unfortunately, this Q has many answers that contributed to the final solution. What I'd suggest is that you  pick the few that helped you the most in reaching a working solution (if they only turn out to be I8's posts then so be it).

As for the grade, as I8 said, it should reflect how compete you feel the answers were and how helpful you feel the experts have been in assisting you. However, you don't need to close a Q if you are not happy, you can always ask for more assistance.

Anyway, welcome to the site.
0
smurf_killerAuthor Commented:
i certainly hope that you agree with the points given now, im just sorry that i couldn't give you more points
0
evilrixSenior Software Engineer (Avast)Commented:
Many thanks sk.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.