C++ :: How To Make Own Binary Trees And Encrypt Messages

Jun 8, 2013

I'm having some trouble with my binary tree for school. It is a data structures class so we are working on learning how to make our own binary trees and encrypt messages. Everything so far is working, except for my delete node function. I'm trying to do it recursively. Parts of my code.

/******** Node *********/
struct node {
char data;
node* right;
node* left;
};
/******** Binary Tree Class *********/
class BinaryTree

[Code]...

View 5 Replies


ADVERTISEMENT

C/C++ :: Printing Binary Expression Trees

Mar 18, 2014

I am working on a program that needs to take any infix expression as an input. And the display the expression tree of it on the console as an output. For example the input goes (a+-(c*d) should output:

-
+ *
a b c d

View 1 Replies View Related

C :: Search And Delete Function For Binary Trees

Apr 1, 2014

I had an assignment that I completed and it was just inserting values into a binary tree and then displaying it. I was wondering what the code would be if I wanted to delete a number in the binary tree, or if I wanted to search for a number. Here is my code for my assignment.

Code:
#include <stdio.h>
#include<stdlib.h>
typedef struct bt_{
int value;
struct bt_ *right;
struct bt_ *left;

[Code] ....

View 1 Replies View Related

C++ ::  Binary Search Trees - Counting How Many Levels Are There

Jan 29, 2013

So I have this code that I wrote that pretty much makes a binary search tree with one node per element that holds the data int, one pointer for left, and one pointer for right. My tree is set that if you give it a number it starts as root, then afterwards any number you give it will either be placed left or right if it smaller than the current node or bigger respectively until it hits a pointer that points to NULL.

I was able to get my code to display the numbers in order no matter how bad you inserted the numbers to throw me off. My question now is this, how can I make it count how many levels there are? I'm not sure if this is clear or unclear but I want it to take all the paths and return to me the longest path and that should be how many levels there are.

#include <iostream>
using namespace std;
class binarySearchTree {
private:
class node {

[Code] .....

View 6 Replies View Related

C++ :: Encrypt Char Array With Binary Data

Apr 14, 2013

I am trying to encrypt a char Array with binary data.

I think I understand the basic of Encryption / Decryption but I fail to see how to implement something.

I am trying to have a "key" that needs entered so the data can become readable executable. The program I am encrypting is a small console window with a message with the text "A secret message from your friend" (Not that it matters).

I have the binary data witch I can copy and what not. But how go about Encryption and then decrypt it and not destroying the data.

View 6 Replies View Related

C :: Create List With Employees Of Company Using Binary Trees

Dec 5, 2013

My colleague and I have been given a task to create a list with the employes of a company using binary trees. Each employee/node has to contain the following information:

- Employe name
- Rank
- ID Number
- monthly Salary

We have to write a C program (using Codeblocks) which builds the company tree with the information above and afterwards lists all the employes who have a salary bigger then a number specified by the user.

So far so good. We've had a look on the examples on the internet and after finding one which looked friendly enough we started working on that one to suit our needs. Credits for the original source code to: C Program to Implement Binary Search Tree Traversal - Basic C Programs | C Programming Examples

We've reached the point where we're able to insert the required information but being able to list all the employes who's salary is bigger then the number given by the user seems to be rather difficult to achieve. I'll include the code next. We have left almost the entire pieces of the original code and we are aware that the are still things which are not required for our assignment, which only requires to enter the 4 information above and afterwards display the employes with the before mentioned condition concerning their salary.

Code:
# include <stdio.h>
# include <conio.h>
# include <stdlib.h>
typedef struct BST

[Code] .....

View 1 Replies View Related

C/C++ :: How To Encrypt The Password To Be Inputted

Sep 14, 2014

#include<stdio.h>
#include<conio.h>
#include<string.h>
char str1[20], str2[20]="kent";
main() {
printf("Enter your Username: ");
scanf("%s",str1);

[Code] ....

View 1 Replies View Related

C++ :: How To Encrypt TXT Document Using Caesar Encryption

Mar 1, 2013

so i need to encrypt a txt document using Caesar encryption. however i don't know how to open a txt and shift the keys into a new txt. the program has to ask the user for the number it should shift. Using arrays, if else. i also need to make a menu so i am using switch.

View 4 Replies View Related

C++ :: Saving Info Like Trees And Such In A File?

Aug 13, 2013

I'm intrested in creating programs of games and such which learns while playing and saving the information for further use. For example a tic tac toe game where the program saves evry game it won or lost and creates a tree of some kind that store the information of the game and save it in a file when the program is being quit. The problem i'm having is how to save a tree in a file efficently.

View 2 Replies View Related

C/C++ :: Disease Prediction Using Decisional Trees

Oct 19, 2014

I have made cancer prediction based on symptoms using decision trees but i am not able to run my code ...
 
#include<iostream>
using namespace std;
#include<conio.h>
#include<string.h>  
struct dectree {
    char symptom[50];  

[Code] ....

View 11 Replies View Related

C++ :: Deleting Node (With Two Child) In Trees

Sep 20, 2013

I have Problems with deleting node in trees!my first problem is I don't understand the algorithm of deleting a node with two child! I write some kind of code that delete a node with two child but I think (maybe I should say I am sure ) that it has runtime or logical errors or something like that!

My second problem is my code doesn't work if my node is root of tree!because I don't know if it is root what should be the parentPtr in my code! I set parentPtr to NULL in this situation but I know it is wrong!

Here is my Code :

#include <iostream>
#include "TreeNode.h"
using namespace std;
template<typename NODETYPE> class Tree {
public:
Tree();
void insertNode(const NODETYPE &);

[Code] .....

View 3 Replies View Related

Visual C++ :: Red / Black Trees Value Deletion

Nov 26, 2013

I've been working on my deletion function for Red and Black trees but can't seem to get it to work. From what I can tell, the remove function, instead of deleting the single value that will my prompt by the user, will delete all the values that are in the red and black tree.

Code:
bool RedBlackTree::remove(int x) {
if(!search(x)){
return false;
} else {
Node* z = new Node(x);
rbremove(z);

[Code] ....

View 4 Replies View Related

C :: Program Attempts To Encrypt A File Using XOR Operator?

Mar 18, 2013

My program attempts to encrypt a file using XOR operator. However, when I attempt to encrypt a file, it says "Error in reading file", (a printf function I set up if the program could not read the file, obviously). The problem is that I don't know what's causing this. Instead of encrypting the file, it just deletes all the characters in it, so I put in a fprintf to put place some text into the file. Here is the code:

Code:

#include<stdio.h>
#include<string.h>
int encryptd(FILE *);
int main(void)
{
FILE *fileptr;
int recode;
char fname[25];

[Code]...

View 7 Replies View Related

C :: Program In Which Computer Will Read Txt File And Encrypt It

Jan 1, 2014

I am writing a program in which the computer will read a txt file and encypt it. The encryption works fine, but the computer cannot read the file perfectly. If there's a newline, the scanning process stops. For example I have the following text in the txt file.

One two three four five
(newline) Six seven eight

The computer will stop reading after 'five'. I assume that is because I use fgets.

View 4 Replies View Related

Visual C++ :: Create A Function Using Rot To Encrypt Strings

Sep 30, 2013

I need to create a function using rot to encrypt certain strings the function begins like this

#include "encrypt.h"
std::string encrypt (std::string text, int rot) {
for (int i
and ends like this
return NULL;
}

dont need to write the string encrypted and dont need to crate a decrypt function.

View 4 Replies View Related

C :: Encrypt Message Within BMP File - Incorrect Struct Size

Feb 9, 2015

I'd wrote a program to encrypt a message within a bmp file using my own structs and all for everything (yes, call me a ........head) The program works but for some weird ........ing reason I was forced to subtract 2 bytes from the header size to get the correct value. I've narrowed down the issue to my BmpFileHeader struct.

Here's a short program that demonstrates the issue:

Code:
#include <stdio.h>
#include <stdlib.h>

#define BYTE unsigned char
#define WORD unsigned short
#define DWORD unsigned long
#define LONG signed int

[Code] .....

Tried with both gcc and TinyCC and got the same result so it doesent seem to be a compiler bug. Microsoft's structures though are giving the correct size, even though they have the exact same definition.

Microsoft's defines:

Code:
// windef.h
typedef unsigned long DWORD;
typedef unsigned char BYTE;
typedef unsigned short WORD;

[Code] .....

View 5 Replies View Related

C++ :: Gather Input From User And Encrypt / Decrypt Those Characters?

Jan 5, 2015

I have got to create a program that will gather input from the user and then encrypt & decrypt those characters.

I'm not very confident at coding so I'm sure many parts of my code are written poorly and not following the best practice so I have written a simple version of an algorithm where the program simply adds/subtracts a value of 2 to/from the ASCII values but I have discovered the use of the rand() and srand functions but I'm unsure how to go about using them within both my encrypt and decrypt function as a single value (static variable?).

Here is my code in its entirety at the moment.

#include <iostream >
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
using namespace std;
char getMenuSelection (char m);
void encrypt (char key[]);
void decrypt (char code[]);

[code]....

This code currently doesn't execute due to ' undefined reference to 'encrypt(char*) '

Question

I am asking how to generate the random number and incorporate this into my encrypt and decrypt functions.

1. Would the use of a static or global variable make this work as is?

2. Would I need to create separate class files for both functions?

View 2 Replies View Related

C# :: Sending Messages To Log In And Password

Apr 20, 2014

I wanted to make an program which is sending messages to log in and password, but instead of message it gives me "System.Windows.Forms.TextBox, Text: AND HERE MY TEXT I WANTED.

View 9 Replies View Related

C++ :: Array Manipulation Of Messages?

Mar 25, 2014

Basically i need to encrypt a message into ascii values & i also need to allow the user type some ascii values thus decrypting the values into characters that are placed within the code.

#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
using namespace std;
#define Q 2000
void main(){

char array1[Q]={"A gentle, dull flickering flame, burns in the marble hearth. Its dim light scarcely illuminates the small, cozy room with its quiet elegance. The dismal light plays softly causing shadows over the solitary figure of a wooden desk at which Allen was roaming through his memories. Thinking back in the past where he once had a friendship which was out righteously incredible. She was the girl of his dreams, in a way which she had everything he had ever sought out in a beautiful and clever girl. Most of all she had his heart. Her style was incredible in the way the outfits she would wear would match perfectly giving a deep vibrant lively feeling."};

int S[Q];
char S1[Q];
int x;
int i;
char e, d;
cin>>x;
if(x=d){
cin>>Q;
for(i=0;i<array1[Q];i++)
cout << S[i]<<endl;
for(i=0;i<array1[Q];i++)
cout << S[i]<<endl;
}

View 18 Replies View Related

C :: Connecting To SMS Server And Send Messages

Nov 11, 2013

I'm currently in the middle of designing a program for some project. one part of the program is to send reminding SMS messages to the employees.

I have already subscribed to a SMS provider and they gave me an access to a control panel (aspx). But now I'm wondering how will I be able connect to the SMS server and be able to send messages?

View 11 Replies View Related

C/C++ :: Schedule Sending Of Messages From A Process

Mar 18, 2015

I am new to this area and have the requirement like:

1) A running process wants to send message based on event arrival.

2)the process checks if event is critical

3)if critical then it has to send message immediately ,else send after time t.

4) The process is continuously process the events . so once it knows the event is not critical and has to send message later it has to proceed with its normal operation.. only when time 't" comes it has to come and send message.

View 4 Replies View Related

C++ :: Possible To Alter Error Messages For A Particular Line?

Apr 23, 2012

Is it possible to alter an error message for a particular line if you think it might fail compilation? GNU specific stuff is okay. The reason I want to do it is because I have this code.

Code:
template <size_t S>
struct assertion{}
int main(){
{
volatile assertion<sizeof(config::input)> asrt = assertion<sizeof(config::output)>();
}
}

If the arrays config::input and config:utput are different sizes, I want it to be clear that that's what needs to be fixed. Is there an __attribute somewhere that will allow me to do that?

View 2 Replies View Related

C++ ::  List Initialized Vector Is Having Error Messages

Jan 16, 2015

vector<int> vec1 {2, 4, 6, 8, 10, 12, 14, 16, 18, 20};

This code worked perfectly fine in Xcode earlier today, but when I got home on visual studio 2012 express it is having an error. It's saying that the local function definitions are illegal and has a red mark under the '{' only?

View 2 Replies View Related

Visual C++ :: IE WebBrowser Not Sending Some Redrawing Messages

Aug 22, 2013

I have a property sheet view with few property pages. One of this property page contains a HTML representation via a CHtmlView derived class.

Initially, the .html file is correctly rendered. The problem is that sometimes switching between properties pages sometime the html file is not redraw. The behavior appears randomly.

According to Spy++ in such situation some Windows messages are not sent by WebControl (Internet Explorer_Server layer): WM_ERASEBKGRD, WM_PAINT or WM_NCPAINT.

Approaches such Q179421 or Q183161 are not useful. My machine runs IE 10.

The windows hierarchy is: Shell Embedding -> Shell DocObject View -> Internet Explorer_Server.

Any workaround that would determine Internet Explorer_Server layer to send these messages always?

View 4 Replies View Related

Visual C++ :: Intercept Messages Sent To Controls On A Dialog

Apr 8, 2013

If it is possible, I'd like to know how to intercept messages sent to controls on a dialog. I'm working on a large application with a large number of dialogs, each with a number of controls on the dialog. I need to be able to intercept messages sent to these controls so that I can determine if the controls really need to take action on these messages. I could subclass each control and override the specific event handlers but due to the volume of controls in the application this could take a very long time, will introduce risk if controls are missed, and will increase maintenance costs. What I want to do is create a class which is derived from CDialog and each of the dialogs in the application would then be derived from this new dialog class. The new dialog class would intercept messages sent to any control on the dialog and if the dialog decides that the control should do something then the dialog will pass the message on to the control.

example:
CExistingDialog is derived from CNewDialog is derived from CDialog

CExistingDialog has a number of controls. When the code in CExistingDialog calls CWnd::EnableWindow on one of these controls I want CNewDialog to intercept the message, determine what should be done with the message, and then pass it on to the control.

I'm not very familiar with the messaging framework. I've tried overriding a few of the methods of CNewDialog but none of them ever receive the message to enable the window. I assume this is because the message is sent directly to the child window (the control).

Is there any way to intercept these messages? I don't know much about hooks either but is this a possible option?

View 8 Replies View Related

C :: How To Make Text File Of Bits Stored In AVI / Binary File

Feb 5, 2014

I need to create a program which could create text files of the bits stored in avi file/binary file. My first requirement is to show 0s and 1s in the text representation . My second requirement is to create an avi file from this text file. I have tried few codings but either they give me error or they not playing the reconverted binary files.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved