49,761 Topics
| |
I need help figuring out if two numbers are co-prime. So far I have this (prime() is a bool function) [CODE]void GetE(int& e, int& result) { int random = rand(); do{ while(prime(random)) { if(random < result) e = random; else random = rand(); } while(!prime(random)) { random = rand(); } … | |
I have to write a slot machine program where theres 3 wheels. wheel 1 = cherry, cherry, cherry, plum, plum, bell, bar wheel 2 = cherry, cherry, plum, plum plum, bell, bar wheel 3 = plum, plum, bell, bar, cherry cherry. when wheels "spin", output should show three items from … | |
Hey guys, I written a base class (AudioTrackElement), and derived a class from there (Looper) and another (VolumePan). The looper class implements functionality, while the AudioTrackElement is there just so I can hold many Loopers and VolumePan objects in the same vector. The problem: I can create a [icode]std::vector<AudioTrackElement>[/icode] no … | |
My assignment asks me to Implement a Linked List class with FoodItem as the objects to be inserted in the class, and implement a PrintList function member that prints the name of each food item in the list. Implement a SelectPrint function member that only prints the food item names … | |
[B]Program goal[/B]: user input for 2 equations to evaluate the operator signs. i.e. 1 * 2 + 4 - 4 and 5 - 2 * 6 + 9 would be the same --> " * + - " in both, order does not matter. [B]Output[/B]: cout saying match or not … | |
hi , i have this assignment but i don't know how to find the structured ? the program needs to use the structure that stores the following data: Drink Name Drink Cost Number of Drinks in Machine and we need to create an array of 5 structure with this: Drink … | |
Hello! I'm trying to alter a raytracer program which is supposed to create a picture of 25 spheres. It's an exercise in optimization so I'm basically trying to make the program run without any unnecessary code, making the program specific for the intended output. I'm using a C++ array to … | |
Hi, I am engineering student, currently working in a project in the field of image processing. Project would involve extensive use of MATLAB or Open CV. I have past experience of working in project involving mobile application development and subsequent deployment on mobile platform. I would like to discuss various … | |
Our professor ask us to upload our program in a website, I've been searching through the web with possible ways, but I still can't figure it out how to do it. Do we have to use the .cpp file? There's another problem, I a trying to run the "Application file" … | |
Hi! I need to write a program that moves some letters to the end of a word for example if i enter : cook look book telephone, the result would be: ookc ookl ookb elephonet. i came up with some code but then my ideas run aout...some help would be … | |
Hello all. I'm trying to compile a socket program in DevC++ but everytime I do it I get a lot of linker errors like these: [CODE] [Linker error] undefined reference to `WSAStartup@8' [Linker error] undefined reference to `htons@4' [Linker error] undefined reference to `inet_pton' [Linker error] undefined reference to `socket@12' … | |
Hi guys, i need your help i new to this homepage and im learning c++ i've got homework about this weekend to create something like that: [B][U]Give your Informations (<FirstName> <LastName>, <dd.mm.yyyy>)[/U][/B] now i want to ask you how to check with c++ if a string got a "," would … | |
Hello, im trying to implement a generic double linked list, and i have added just one function(insert). But im getting some errors. Here is the code: [CODE]#include <iostream> #include <cstdio> #include <string> using namespace std; template <typename T> class doubleList { private: struct Node { T info; Node *leftPtr; Node … | |
How do I write a a recursive function that counts the number of sequences that sum up to that number (user input)? | |
I have a problem printing the winners in my Voting Program. Please help me finish it. [CODE]#include <iostream> using namespace std; void DisplayOptions(); //void DisplayOptionsVice(); int InputVote(); int UpdatePoll(); void DisplayPoll(); //void DisplayPollVice(); int VoteArray[5]; //----------------------------- void main() { int option; int loop; int ctr=0; for(loop=0; loop<6; ++loop) { VoteArray[loop]=0; … | |
i am not sure why the value of b is coming out as 0 according to me it should come out as 3 [CODE]#include <iostream> using namespace std; void read(int a[],int n) { for (int k = 0;k < n;k++) { cout << "enter the " << k << "th … | |
For class I have to use a stack to find if a word entered by the user is a palindrome... [CODE]#include <iostream> #include <string> #include <stack> using namespace std; int main() { char *word; int count; stack <char> mystack; stack <char> rev_stack; cout<<"Enter a string "; cin>>word; while(*word!=NULL) { mystack.push(*word); … | |
Arrays are passed by reference (address) by default. Function takes an array and tries to return average, sum of elements, and the sum of the squares. Calculate and display sum, sumsq using for loop in the function definition display sum, avg, and sumsq to see the difference between the values … | |
I have made... well attempted at making a unique random number generator using arrays and functions, but it still will not work and I cannot find my error at all. Can someone please help? T_T [CODE]#include <iostream> #include <ctime> using namespace std; // *****Function prototypes**** void displayArray(int randNum[], int elements); … | |
My problem is to make a program that stores a High temperature and a Low temperature within a two dimensional array and then displays the Average. I can get the numbers to be stored(I think, but the average doesn't work at all it seems to display the last number entered … | |
Hi, I'm having to write Conway's game of life for school and I'm having a little trouble with it. Whenever it runs through the code, all of the 'cells' move to the left a bunch and warp around the screen.. I'm not sure why.. Any help would be great! Thanks! … | |
I need to create a ResistorClass overloaded logical OR operator function which shall do the following: Overload the logical OR operator ( || ) to calculate the equivalent parallel resistance of the nominal values ( m_dptrRes[0]) of two Resistor Class objects. The formula for calculating parallel resistance is: NominalValue1 * … | |
Hi I need help!! My program is supposed to count word occurences from a text file and the output is supposed to look like this a 2 count 1 hello 1 test 2 this 1 words 1 but instead it does this : a 2 a 2 count 1 hello … | |
I have created a histogram program that has the user enter the lower limit of the range, then generates a 20 number array with that number at array[0] and the lower limit + 20 at array[20]. It then does a random number generation where 85% of the randoms are within … | |
Hey; I am having problem with the read and write functions in fstream. They need to have a const char * to read or write from/to buffer. I need to work with integers. Here what happens: [CODE]for(int i = 0; i < numberOfValues; i++) { int random = rand() % … | |
Well, i'm really new to this programming thing, but i don't have a teacher or anything like that, i'm an autodidact so I really have a lot of questions on this matter. I'm trying to do a project using Augmented Reality. As far as I know, there are two main … | |
[CODE]cout << "The sum is " <<sum<<endl<<"The sumCheck is "<<sumCheck<<endl; if (sum==sumCheck) { cout<<"Is a polygon"<<endl; } else { cout<<"Is not a polygon"<<endl; } [/CODE] The sum is correctly displayed as 360 and sumCheck is correctly displayed as 360 yet the message "Is not a polygon" is displayed. I can't … | |
Hey all, I'm creating a text-based RPG and am just now getting to the fighting mechanics. I want to use the rand function to choose a random number within a certain range but am having trouble getting it to execute correctly. [CODE]#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; … | |
I need to compress monochromatic bitmap with modified huffman algorithm here's the algorithm: [url]http://www.iet.unipi.it/m.luise/HTML...n%20Coding.htm[/url] as you see i need to replace pixel (bits) sequence with some bits sequence variable length so im not sure which type to use for bits manipulation iI found this class for bits [url]http://www.codeguru.com/cpp/cpp/cpp_...nipulation.htm[/url] and this … | |
Hi, I have a method call say some fucntion that takes in a pointer of an array of char [CODE]char anArray[32]= {'1', '2', '3', '4', '5', '6'}; // the function call someFunction(&anArray[0]) [/CODE] I don't think I have quite grasped the concepts of pointers yet, does the code i have … |
The End.