d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Looking For C++ Help. College Student
Add Reply New Topic New Poll
Member
Posts: 1,329
Joined: Nov 21 2012
Gold: 0.50
May 6 2015 12:17pm
As title says

MY current assignment is to implement the use of nodes , linked lists, and etc into my current ongoing project. This is a first in any of the classes I have taken where we are required to put together all the material we have learned.
I'd also like to learn basic things on how to become a better programmer and what not.

Message me about payment/rates . Not looking for something extremely expensive.
If you're also willing to just help that would be great! I'd love to learn.
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
May 6 2015 12:58pm
Generally how it works is you post your problems and questions along with the code you current have and then we offer advice or answers.

We usually do it for free as well but accept donations.
Member
Posts: 1,329
Joined: Nov 21 2012
Gold: 0.50
May 6 2015 02:58pm
Ah okay.
Is it legal or acceptable to ask for tutoring/help

But the current problems I;m running into is not knowing where to start giving a set of things i need to do.

A current problem in my code is:
//def constructor
MonthlyEnvelope::MonthlyEnvelope(int month, int year, const Envelope& envelope, double starting balance, MonthlyEnvelope* next)

I believe that was the line of code that was giving me an error.
The error I get is uninitialized variable or w.e . It's the const Envelope& envelope that's causing it.
Sorry if my question is poorly worded.
I spent some time googling for answers but no lucky understanding what I need to do.

Any help is appreciated and I a not great at understanding programming concepts yet.(especially pointers and such, just the basic ideas)

This post was edited by epidemic20 on May 6 2015 02:58pm
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
May 6 2015 03:07pm
An uninitialized variable should be a "warning" rather than a compile time error preventing you from running your application. It is basically saying that somewhere the variable was not assigned data, which is bad depending on the uses.

For example if a integer value was uninitialized and you tried to use it, the integer value can be anywhere from the most negative integer number to the most positive. And you have no control over what number that is. To prevent this you must assign it a number which is pretty normal to do anyways.

Uninitialized pointers on the other hand are more dangerous since they can point to anywhere in memory, and if you try using them in their uninitialized state you can cause wonky results ranging from garbage output, to the application crashing.

So that leaves it as, how are you initializing that variable also known as, how are you creating it.

Most of the time you can fix this just by assigning a proper value or memory to the data type.

Example would be:

Code
struct {
int myInt;
} myStruct;

struct myStruct *s; //s is not initialized
s = malloc(sizeof(struct myStruct)); //it is now fully initialized


Forgive my C as I haven't used it for a long while.

This post was edited by AbDuCt on May 6 2015 03:10pm
Member
Posts: 1,329
Joined: Nov 21 2012
Gold: 0.50
May 8 2015 11:56am
Thanks but I ended up needing to use an initializer list
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
May 8 2015 06:38pm
Quote (epidemic20 @ May 8 2015 01:56pm)
Thanks but I ended up needing to use an initializer list


Thanks, for not even giving any information to solve your problem.
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
May 8 2015 07:47pm
Quote (AbDuCt @ May 8 2015 07:38pm)
Thanks, for not even giving any information to solve your problem.


product management?
Member
Posts: 1,329
Joined: Nov 21 2012
Gold: 0.50
May 8 2015 09:06pm
Quote (AbDuCt @ May 8 2015 04:38pm)
Thanks, for not even giving any information to solve your problem.




Sorry, I wasn't sure what I should've provided... Just thought the function and the error was good enough. But I still appreciate the help!
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
May 8 2015 10:06pm
Quote (epidemic20 @ May 8 2015 11:06pm)
Sorry, I wasn't sure what I should've provided... Just thought the function and the error was good enough. But I still appreciate the help!


Technically the entire function, and not just the prototype would be needed.

As well as any points at which you call the function would be needed as well.

Envelope is a typedef and could literally be anything.

I could typedef int as string, and confuse the fuck out of everyone, and without knowing what it actually was no one could help you.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll