49,755 Topics
| |
An office furniture company sells furniture in three colors: red, black and green. Every item in their inventory system has a 5-character code. The last two characters are always used to represent color. If an item is red, the last two characters are “41”. If an item is black, the … | |
This code is just a function in a bigger code, but I'm having a problem with the break. I'm not sure I'm doing it right, but basically if the factors are zero, then the program should say the equation can't be factored. It does that, but then continues through the … | |
Hello, I'm trying to determine where a small matrix would fit inside a big matrix.. But, the small matrix is not in the big matrix so I need to see how simular they are.. The one with the lowest value, is the best fit.. So my difference function is this: … | |
I am fairly new at C++ and Im having a lot of trouble understanding how to do it. This is part of a homework assignment due next week and I have no idea how to even start it (much less finish coding it). Can anyone out there help? ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Create … | |
This may sound really noobish, and I'm probably missing something really stupid.. But, I'm trying to calculate the differences between matrices, and the one with the smallest value (result) is the matching number.. But, for some reason my algorithm seems to be missing the smallest number and I can't figure … | |
This is probably a really simple and stupid question, but when I try to "Build and Run" an OpenGL program on XCode, it seems to debug it and open the window for a split second and then close. There aren't any compilation errors and it finishes saying that the debugging … | |
So, I'm playing around with SDL and I've come across a bit of a bump. I have one image and I am trying to "free" that image to put on another one. Here is what my code looks like.. [CODE] // I did get a good section of this code … | |
Hello, I'm creating a game using SDL, and what I'd like to happen is: if the character jumps on a button, then it'll disappear. However, I cannot find a way of accomplishing this, as all the SDL functions I know of start at runtime and cannot be changed. If I'm … | |
Hi, I'm trying to sort a list of names in c++ (first name and last name). I'm running into a couple of problems with my code. I'll post the code first then state my problems. #include <iostream> #include <stdio.h> #include <cstring> using namespace std; const int numNames=3;//this makes the code … | |
I am implementing RSA in C++ and here's my design(code structure). *keygen.h* namespace rsa{ class keygen{ public: //Constructor keygen(size); //Generate keys void generate(); //Getters string gete(){ return xyz; } .. .. .. private: //initializes bignums void initall(); keygen(){} //Private Member variables goes here } } *prime.h* namespace rsa{ //First 100 … | |
somebody pleae post some basic C++ excersices of loops.please help me i am a beginner. thANKSS | |
Hi i need help with moving a light. at the start of the program i define the floats. `GLfloat Light_Ambient[] = {0.7f, 0.7f, 0.7f, 255.0f};` `GLfloat Light_Diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};` `GLfloat Light_Position[]= {0.0f, 1.0f, 3.5f, 1.0f};` but later on in the program while the scene is running i … | |
I have not found anything that addresses these questions. Any help is appreciated. If I have a class that has pointers to objects of a user-defined class as members, is there any problem with initializing those pointers with the initialization list of the constructor? For example, where A, B, and … | |
Can anyone show or explain how to do a base conversions ? I'm new so this concept is confusing so far i got to but I have no clue to get answer from base 10 to any base 2 to base 16 #include <cstdlib> #include <iostream> #include <string> using namespace … | |
I have googled this and I see how to do the clock function with insertion and I was pretty sure I implemented it right but the insertion sort never shows any time. I am not sure if I am not waiting long enough but I have had the program up … | |
I'm sure I'm missing something basic here, but I cannot get this to compile. Using codeblocks 10.05 with mingw build of gcc 4.4.1. I've included unistd.h and tried replacing MAXPATHLEN with PATH_MAX but every time, it gives me: error: 'MAXPATHLEN' was not declared in this scope or error: 'PATH_MAX' was … | |
I have a question about istream iterators and reading the input to the EOL. How do you do it? I tried the following but had to revert to a hack to get it to work. My first attempt reads from the istream but a word at a time. first.cpp #include … | |
I'm trying to solve Problem #54 of Project Euler, which is basically evaluating poker hands. My program currently outputs 383, but the answer should be 376. My full code #include <iostream> #include <string> #include <fstream> #include <vector> #include <sstream> using namespace std; //CLUBS=14; //SPADES=15; //HEARTS=16; //DIAMONDS=17; int value(char str){ switch … | |
Hello, Could anyone explain details about three different case and output. Here is the code and output: #include <stdio.h> void foo(int n) { n = 6; } void fooWithRef(int& n) { n = 6; } int main() { int n; foo(n); printf("Case_1 Result: %d \n", n); n = 4; foo(n); … | |
The problem is simple. I have LoadLibrary on my c++ app and I want to load c# library but I don't know the entry point. | |
Hi, I have read something on IBM's site about exception specification and pointers to functions: void (*f)(); void (*g)(); void (*h)() throw (int); void i() { f = h; // h = g; This is an error. } IBM says: > The compiler allows the assignment f = h because … | |
Hi there!) Guys please tell me - where can I see the realization (or custom realization) of fprintf in C++ ? I'm especially interesed in working with no fixed number of passed parameters. I need to made somethings like fpintf() by myself but i don't know how.... big thanks in … | |
I hav this code below.How can i use Macros , so that i can change at random "-" and " " without searching through the codes? #include <iostream> using namespace std; int main() { int row,col,n; cout<<"Enter an Integer number:\n"; cin>> n; cout<<("Numerical Pattern\n"); for ( row = 1 ; … | |
Please i'm having problems sorting nodes in a linked list but i can sort the data members and i want to know if sorting the nodes themselves in the list is necessary at all. In other words are there instances where nodes are specifically needed to be sorted. Also, why … | |
Instead of using User input , how can I take an parameter input and convert it to a string, where I can than check for for input values. char values[17] = "0123456789ABCDEF" ; char numIn[15]; int num[15]; int ob, nb, i; | |
This is a minor issue that I'm having in a larger program. The program is for factoring a second degree polynomial. The function below is supposed to find the factors, which is does, but let's say a=6, b=1, c=-12 so a*c=-72 and I want the two numbers that will add … | |
This is my first time to try using STL maps. The code looks correct as far as I can tell, but when I try to compile a test file that does nothing but include the header for the class and declare a variable of that class, I am getting compiler … | |
This code is supposed to find the nth prime number (n being input by the user). I have the code to calculate whether a number is prime or not, but I don't know how to get the code to display the nth prime number. #include <iostream> using namespace std; void … | |
Can anyone help me make a code or advice I need a code that takes 2 parameters eg. integer 123 and base number from 2 to 16. Using argv[1] and argv[2] any help greatly aprreicated |
The End.