IT/Software career thread: Invert binary trees for dollars.

Noodleface

A Mod Real Quick
38,245
15,030
My algorithms class they didn't care what language you used as long as the teacher could understand what you did
 

a_skeleton_03

<Banned>
29,948
29,763
c/c++ seems like a weird choice for a algorithms class. What degree you getting bro?
Some IT Management degree, it's a way to better myself and use my GI Bill. All the rest of the classes are networking since that is what I do on a day to day really is manage networking guys.

I think I will visit Python and Ruby later on, I don't mind the concept of scripting even though it looks like coding. I just have no desire to code ever.
 

a_skeleton_03

<Banned>
29,948
29,763
Good on you. When is your assignment due / when will you actually need our help?
The first one is due last week, the second one is due Sunday. They are both essentially due Sunday.

I am just working them out slowly in here because he accepts late work whenever at a 80% minimum.
 

Tuco

I got Tuco'd!
<Gold Donor>
46,830
78,468
The first one is due last week, the second one is due Sunday. They are both essentially due Sunday.

I am just working them out slowly in here because he accepts late work whenever at a 80% minimum.
and this is your final project? as in you won't be tested on these concepts and can move on with your life? Or will your next assignment be to calculate the area of a self-intersecting polygon?
 

a_skeleton_03

<Banned>
29,948
29,763
This is the code they gave as an example and I am trying to work with it to try and figure out what I am doing wrong trying to call up the function.

Here is mine currently.

They are using C and I am doing C++ as you can see but I think I am doing all the proper things.

Here is the error output I get.

So here is the part that "matters" for this aspect I think if I am understanding this.

Here would be my version of the same concept.

So they have this Results = Cube(intValue); portion there and they are using intValue earlier. I don't think I am properly labeling that just generally that part I screwed up. Maybe that doesn't actually reference down below the way I think it does. Going to try something and then post.
 

Noodleface

A Mod Real Quick
38,245
15,030
I think what you're confusing is they for some reason prepended "int" as part of their variable name. In their case the variable name is "intValue", in your case the variable names are "length" and "width". See if you can figure out my meaning from that.
 

Tuco

I got Tuco'd!
<Gold Donor>
46,830
78,468
Why did they give you the code to complete the project? besides using a rectangle and using peremiter how are you tasked with rewriting it differently?
 

a_skeleton_03

<Banned>
29,948
29,763
Okay I got it working after looking at a functions tutorial in C++ for some reason every example I had was in C and they put functions at the end, and they work. I guess in C++ they need to be before int main() or something? Is that right? If so, why?

 

a_skeleton_03

<Banned>
29,948
29,763
Why did they give you the code to complete the project? besides using a rectangle and using peremiter how are you tasked with rewriting it differently?
No, that was a similar hands on lab they gave us to see the concept of function working and then we are given a 'task' to complete using the concepts learned.
 

a_skeleton_03

<Banned>
29,948
29,763
Here is the final.

final_sl said:
Final Project

Your final project will be to analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at least one function call and the use of at least one array. The specific problem you need to solve for the final project is:

Design a program that will allow a user to Input a list of your family members along with their age and state where they reside. Determine and print the average age of your family and print the names of anyone who lives in Texas.

There are 6 components of your submission including:

Program Description- A detailed, clear description of the program you are building.
Analysis- Demonstrates your thought process and steps used to analyze the problem. Be sure to include the required input and output and how you will obtain the required output from the given input? Also, include your variable names and definitions. Be sure to describe the necessary formulas and sample calculations that might be needed. Talk about the functions you plan to use and how you will use arrays. Be sure to talk about the types of programming statements that will be used on why.
Test plan - Prepare at least 3 sets of input data (Test data) along with their expected output for testing your program. Your test data can be presented in the form of a table as follows (note: feel free to adapt to your design)
Pseudocode- Provide pseudocode of your overall design that fulfills the requirements of the project
Source Code
Demonstrated output (Screen Shots)
All of these components should be placed in word document for submission.

Additional details about the program you need to write:

Family sizes vary, however you should design to be able to enter at least 50 Family members.
Your test cases should have at least 5 family members.
Be sure to separate some functionality into functions or submodules. Having all functionality in the main module is not a good design.
Your design should consider how to indicate the family member entry is complete.
Carefully consider the best data type for each of your variables. (e.g. when to use Float versus Integers versus Strings)
Example application test data:

Test Case #InputExpected Output

1Fred, Age: 82, State: MD
Mary, Age:75, State: OH
Joe, Age: 45, State: TX
Julie, Age: 47, State: TX
Beth, Age: 9, State: TXAverage Age: 51.6
Members who live in TX:
Joe
Julie
Beth

2Your input dataYour expected output

3Your input dataYour expected output
I haven't touched it yet but here is what Tenks posted.

Or something like that
I am going to start going through it now, I was just doing all the rest of the submission of the previous one for that document to be closed out and saved locally, on my NAS, on my google drive, on my Amazon could, and my Dropbox.
 

Noodleface

A Mod Real Quick
38,245
15,030
Yeah looks like it. I understand why functions might need to be defined at the beginning but why in C++ but not in C?

Now the last one with the arrays.
Eh depends on language. You can put main first but you need to put a function prototype before main (Google function prototype)

I think essentially it goes through your code sequentially and hits your function and goes "da fuck I never seen this shit before"
 

a_skeleton_03

<Banned>
29,948
29,763
I just don't understand why it worked in C but not C++. I can understand it needs to know the function before it gets carried away.
 

Tuco

I got Tuco'd!
<Gold Donor>
46,830
78,468
I just don't understand why it worked in C but not C++. I can understand it needs to know the function before it gets carried away.
Short answer: Don't worry about it, and just assume that in both c/c++ you need to put your functions above where they are needed.

Long answer: in C89/C90 (ANSI C - Wikipedia, the free encyclopedia) the compiler just assumed that an unknown function you were referencing had a function prototype with exactly the parameters you were calling it with and returned int. I'm assuming that whatever C compiler you're using follows that standard. ( I could be wrong, you could be using something totally different).

So if your function:
was instead:
the compiler might either choke on it, or worse would cast as an int or something bad. I don't really know much beyond that, I work with C++ mostly.