?
Solved

function isn't printing my array

Posted on 2008-02-02
47
Medium Priority
?
264 Views
Last Modified: 2010-04-21
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

0
Comment
Question by:smurf_killer
  • 17
  • 14
  • 13
  • +2
46 Comments
 
LVL 11

Expert Comment

by:cup
ID: 20805990
Try cout.flush () after the cout << statement where you want the number to display.
0
 
LVL 1

Author Comment

by:smurf_killer
ID: 20806200
it still wont show it :S
0
 
LVL 3

Expert Comment

by:SwissKnife
ID: 20806201
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 1

Author Comment

by:smurf_killer
ID: 20806305
thanks that sounds reasonable, ill try it and get back
0
 
LVL 40

Accepted Solution

by:
evilrix earned 120 total points
ID: 20807289
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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20807435
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
 
LVL 1

Author Comment

by:smurf_killer
ID: 20808851
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
 
LVL 40

Expert Comment

by:evilrix
ID: 20810037
>> 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
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813263
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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813275
>> 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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813307
>> 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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813319
>> 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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813334
>> 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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813336
>> 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
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813339
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
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813347
well i tried to do it with a reference, as shown in my first code, but that didn't work either
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813348
>> 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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813359
I'd question the validity of this cast though, since you could just do...

int valg = 0;
float valgt  = 0.0;
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20813373
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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813378
>> 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
 
LVL 53

Assisted Solution

by:Infinity08
Infinity08 earned 80 total points
ID: 20813380
>> I'd question the validity of this cast though

It is valid like this :

        cin >> valg;
        valgt = static_cast<float>(valg);
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20813382
Return value?
0
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813391
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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813396
>> 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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813409
>> 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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813417
>> 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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813424
>> Yep. I agree.
That's good, I thought I'd overlooked something :)
0
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813434
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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813436
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
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813447
thanks ill do that
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813458
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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813463
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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813528
>> 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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813649
>> 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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813663
>> 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
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813708
i was thinking alot about how to close this question, and i was very unsure, but in the end, that was the problem
0
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813714
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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813720
>> 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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813722
Do you understand that that's not the only problem ?

Can you explain the B grade ?
0
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813765
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
 
LVL 40

Expert Comment

by:evilrix
ID: 20813795
>> 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
 
LVL 1

Author Comment

by:smurf_killer
ID: 20813811
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
 
LVL 53

Expert Comment

by:Infinity08
ID: 20813820
fyi :

        How do I close a question : http://www.experts-exchange.com/help.jsp#hi331
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20813839
>> 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
 
LVL 1

Author Closing Comment

by:smurf_killer
ID: 31427513
i certainly hope that you agree with the points given now, im just sorry that i couldn't give you more points
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20839530
Many thanks sk.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question