49,755 Topics
![]() | |
Hello all, I'm having trouble writing a recursive algorithm to traverse a Huffman tree to encode a message. I'm sure you all know what they are. Here's my algorithm: string HuffmanCode(const char& symbol, const TreeNode<SymbolPriority>* huffman, string &code) { //Base case: you are in a leaf; if the leaf contains … | |
Ok . I am writing a game that generate random 6 array numbers from 1 to 10 the program MUST be using by srand(time(NULL or 0)); Now, I want, because it's a little bit of difficult to generate series per second something that the program will generating the numbers auto.. … | |
Alright so my task was to make a program in C++ that when entering a year would output the date easter landed on and this is what we were given a=year MOD 19 b=year/100 c=year MOD 100 d=b/4 e=b MOD 4 f=(b+8)/25 g=(b-f+1)/3 h=(19a+b-d-g+15) MOD 30 i=c/4 k=c MOD 4 … | |
C++float assigned to unsigned long y I have to write separate C++ expression for: 1) extract the 8-bit exponent field to the low order bits of y, and subtract the 127 bias. 2) isolate the mantissa field in the lower order bits of y, and insert the implicit leading 1. … | |
It seems that i dont fully comprehend how rotation works. So leys say i have a cube and i do this: x = 90.0f; rotatef(x, 1.0f, 0.0f, 0.0f); Notice that my code here may be not all correct, its like that just to symbolize what i mean. So by doing … | |
C++ Write a program TWO (2) groups of students at a private college university are enrolled in certain special courses during the special semester. The courses are taught by different lecturers. At the end of the semester, both groups are given the same tests for the same courses, and their … | |
Hi all pros, can anybody teach me write this programme in c++??? Problem Statement Write a simple Mathematics quiz application which has six selections as below: 1) To register number of participants and name 2) To set level of difficulty (level: Beginner or Advanced) 3) To start the quiz (default: … | |
Hi guys, I'm learning C++ from a book and I have a question about defining unary operators: In the book I'm working with there's an example, where they define a class called point, and define ++ operator for point *as friend*. here's the example: ~~~ c class point { int … | |
Hey guys, I am writing a program which uploads a text file into a linked list then displays a menu prompt to the user. All of my functions work fine except when I try to exit the menu/program. The program crashes and I don't see where it is coming from. … | |
This code is supposed to output a hollow square (size and symbols to be determined by the user), but it doesn't do that. First of all, if I set the size of the square to be 5, it outputs 10-5 sets of both symbols. Also the right column is in … | |
My code is perfectly working on Borland compilers but its not working on MS VISUAL STUDIO ..... please help me that how can i run this code into visual studio ...... ~~~ #include<iostream.h> #include<conio.h> #include<stdio.h> void main () { char array[11]; int temp; array[2]='/'; array[5]='/'; cout<<"Enter Date: "; for (int … | |
Hola code gurus, I’m wondering if there’s a way to use a string to access a specific item in a matrix of int[X]. I have a program which uses enums as iterators to reference a large amount of data. To select an item in the matrix, the user will enter … | |
Hey guys! I have an encryption project for school and i have to randomly generate a 3x3 matrix. I know how to assign the values to the 2d array but i am unsure how to return the array. I know it is possible to return a vector of a vector … | |
Hi, I'm making a windows port of some tftp client / server code [from here](http://www.applied-mathematics.net/myself/myself.html) I've got the server working sucessfully with a diffrent client, however I have come to an impasse with the client code. As I keep getting a server unreachable error, having tried over my local network … | |
This is a simple tictactoe game using Constructor member function I have a problem of outputing if someone won the game or tied. Everything seems working fine. Can anyone mind check for me? I tried to find the problem for so long. Thank you. #include <iostream> #include <iomanip> using namespace … | |
I want to read the contents of a file and input them as variables. I have written this code: while (!numbersList.eof()) { numbersList >> type >> num1 >> num2; Complex *object = new Complex(type,num1,num2); cout << "For line number " << n << ": " << endl; object->printAll(); cout << … | |
Dear group members i want a code to extrct the pixel information from the image in C++ send me da code asap.. | |
I have written this code to get the file in a directory, now i want to make it open the .txt & .ini & .docx and print this line: "=== THIS FILE HAS BEEN COMPRIMIZED ==="; in the file, need help with that code please. Here is my code to … | |
Background Due to a decrease in advertising profit, your favorite (and previously free) social networking site has decided to charge a monthly fee to each member. Frustrated, you set out to make your own social networking site, VisageTome. For now, you will need to make a class to store each … | |
i have problem with my code to search node in link list. can anybody help me? sorry for my english.. node *temp1; // create a temporary node temp1 = (node*)malloc(sizeof(node)); // allocate space for node temp1 = head; // transfer the address of 'head' to 'temp1' bool find = false; … | |
When the score is greater than 100 points the program should ask me whether the score is correct The program should ask me whether the score is correct. The program should not add a score that is more than 100 points to the accumulator with out permission (if(score > 1000 … | |
#include <iostream> #include <string> using namespace std; int main() { string s; for (int i=0; i<10000; i++) { s+=1; for (int j=0; j<i; j++) {s+=0;} } cout << s; } This is a code i wrote to make s=110100100010000... until 10 to the power of 10000. However in the line … | |
I have a list of about 500 names in a text file, i want to be able to get 5 random winners from this file. using C++ how do i do this | |
With what programming languages can you write OS in. I know that you can use C and C++ but are there any other, when i talk about OS i mean everything: from the BIOS & Boot & Kernel & all the rest that is neede to make an opersting system … | |
Pretty stumped on why I am getting so many errors trying to get this to work, the reason terminalArray is not declared is because this is a function, terminalArray was declared before main. Any help will be greatly appreciated! int histArray[10]; int i; int j; while (terminalArray >= 1 && … | |
this is my server code i want to receive more than 1000000 bytes ,so the data should be splited into many packets so i use loop to receive all data ,if i use like this server always wait for client even client sent all data to server ,my messsage is … | |
Hi! I made a program that accepts random numbers, create a binary tree from it, then traverse it using in-order, pre-order and post-order traversal. The program is working well but my instructor added something else, when the user input numbers, it should be arranged just like an actual tree. The … | |
Hello guys i am writing a c++ code that should do the following: 1- Creating a stage group just like the champions league first round consisting of 4 teams each on has 4 attributes ( points, gf, ga, gd) 2- The user must be asked to enter each team name, … | |
I wrote a linked list program in C++ which compiles and works well. But I have been told that a) I have to have two separate structs instead of one that contains both the info and the node; and, b) that I have to use two pointers instead of the … | |
I think I am comparing something incorrectly since it does take in my input and tells me no shortest path.. here is example input and output... 5 7 0 1 1 0 2 2 1 3 6 1 4 4 2 3 5 2 4 7 3 4 3 you … |
The End.