That's pretty much what I want. I need to create my own base with this program, I need to edit this information and in the end, before I go out of the program I want it to be saved (not during...
Type: Posts; User: blunt
That's pretty much what I want. I need to create my own base with this program, I need to edit this information and in the end, before I go out of the program I want it to be saved (not during...
You say I should do this line by line or I misunderstood?
Thanks for help! There are also few good ideas that I could use BUT:
first of all I'd like it to be fully-working program. For now I have two classes: movie and customer. I can add and delete...
I use counter which role is to remember how movies are in base, I write an example so You could see what I mean:
int id_movie=0;
(...)
movie_base[id_movie].setMovie();
id_movie++;
Because it's not the first time today I see someone's mentioned these vectors I decided to give it a shot... and I'm confused a litte.
So I have my class movie, I declare vector:
vector...
Hello there!
I'm in a middle of my DVD rental project. It's my first bigger thing in c++ and I had my c++ classes long time ago, so I have a few issues and difficulties.
So, I have a class:
...
Hey, I'm reading now a C++ tutorial from cprogramming.com, lesson about a structures. And I see now and example of pointers in structures:
#include <iostream>
using namespace std;
struct xampl...
Ohhh god, I'm so stupid. I've never considered that function can be something else than void or int :o
Although not everything is okey.
case 1: system("cls");
...
So, in this example it will be?
int
DSWbalance(struct
tree *root)
{
/*algorithm*/
return root;
}
I'm thinking of something like:
struct tree *mytree;
/*code code*/
head=DSWbalance(head);
int DSWbalance(struct tree *root)
{
What I have in mind is this: x=x+y (x is from now old x plus change)
My line of thought goes like this:
1. My tree points to sth, DSW changes what my tree point to -> DSW changes sth.
2. Now I...
Understood but my mind cannot convert it into C. I think I'm to sure what's mine. My balance function should contain return balance()?
Ah that's my bad, I must have missclicked something: that's what I have:
int DSWbalance(two *p){
struct tree *q;
int i,k=0,nodecount;
for(q=p,nodecount=0;q!=0;q=q->right)...
Yes I did, and it's confusing. All I need now from that article is vine_to_tree and tree_to_vine functions right? It's probably because of C/C++ differences, but there are some things I don't get....
int leftrotate(two **p) {
struct tree *tmp;
int data;
if(*p==0 || (*p)->right==0)
return 0; //no right node
tmp=(*p)->right;
(*p)->right=tmp->left; //move node
tmp->left=(*p);
p->right=tmp->right;
Right my bad, obviously, there should be
@edit: No, I'd rather kill myself than finish that project. Now rotations doesn't work...
p->right=tmp->left;
anduril462, that...
I must admit pointers are my pain in the ass. In my previous assignment I had like 1000 lines of code and all I did was avoiding pointers (I had 0 of them). But this time is no way to accomplish my...
I changed rotation a bit, so it's now:
int leftrotate(two *p) //rotates once
{ struct tree *tmp; int data;
if(p==0 || p->right==0)
return 0; //no right node
...
Yes I know it's not AVL. That was my first concept (so i.e. comment You see it's what's left), but I changed my mind 'cause I'm can't manage AVL. All I want now is two simple binary trees and one of...
Hmm... when I do so, new root is 0, and height of the balanced tree is 0 as well, so still something is not correct right?
Ye, it's already changed to
typedef struct tree
{
int val;
struct tree *left;
struct tree *right;
}one,two;
Hi! I got this little assignment on fundamentals of computer programming. Task is about creating two binary trees (simple binary tree and balanced one) and comparision of it. I've got a whole code....
In another part of my code which You can't see, there is a edition tool. It bases on strcmp(). Actually it's like line 55, but it goes this:
printf("What is the tiitle of the book?\n");...
Is there any idea to print it nicely?
There are unused variables because this is not a whole code, just 1/7.
I'm aware that there is better way to do this, but my deadline is Monday, and with my C knowledge it would take a week to...