49,761 Topics
| |
Hello everyone. I have a declaration that starts off like this inta data[100]; size_t i; I have to write a C++ segment code that will shift data[50] and data[98] up one spot to the locations data[51] and data[99] Then I am supposed to insert the number 42 in data[50] Any … | |
i have trouble starting my final project for my C++ class and heres the layout of the first part.. Command Line Text Editor Part 1: 50% Create a command line editor to and edit files. Each file only needs to be one line long. When launched, the editor shows a … | |
i have a code to read some products from a file.(.dat). it hasthe name, model number, price and its purpose. example. = knife 103 10 cut currently it can read the first 3. The question asks i make a derived class to read the purpose. Here is my code #include … | |
how do u convert the below to a 'for' loop? int x = 123456; int y =0; while (x > 0) { y *= 10; y += x % 10; x /= 10;} | |
Hi im trying to learn polymorphism and i stumbled upon a question. Polymorphism to me means 1 with many forms. here is my code: // virtual members #include <iostream> using namespace std; class CPolygon { protected: int width, height; public: void display(); virtual string area () { return ("FIRST"); } … | |
Hello, guys. This is the fragment of my program. I can't initialize the dynamic two-dimensional array. The compiler says to me that 'y' cannot appear in a constant - expression. But I need that both x and y to be dynamic. How can I fix that? ` float a; int … | |
Hi! I am working into the development of a C++ related Phone Management System where the request is to: 1. Input information of new subscriber: The program should input a line of data from the keyboard in the following format: <surname> <name> ! <telephone1> <mode> ! <telephone2> <mode> ! ...! … | |
I just can't help but feel that there's a more efficient way to do this than with multiple calls to the string[i] operator. I've tried storing the results of string[i], but that leaves me with a char, which I'm evidently unable to compare. I know that I can compare a … | |
I want from you to give me a cpp code of a magic squire like this .. one dimention array takes 16 integers then put these 16 integers in 2 dimention array then test this array if it's a magic squire or not .. if not we will randomily rewrite … | |
hello :) i'm looking for an algo to find out all possible combinations of a 2d array entries, wich are (Tasks x Processors). i.e, i have to find out all possible schedules to schedule tasks against processors. numbers of tasks and processors are variable. Suppose : ............P1.......P2.......P3 .................................... T1........3 ........6..........4 … | |
The language i'm trying to do this in is c++ let's say i have a number 123456 , i want to divide this up into partitions of two so i would have: 12,34,and 56. I want to add the partitions up and it would equal 102. How can this be … | |
| > My code Not working Why ???? there is some processor fault Error |
Purpose: Create a C++ class; use operators, overloading, member functions, friend functions, constructors and private data. • Make the data members private. (This means that the non-member functions below will have to be friends of the Data). • Create a member function called ‘set’ with the same arguments, and return … | |
Hi all, I have a simple OpenGL program (learnt from NeHe of course) and I've tried to implement GLSL shaders into my program. Currently, its meant to draw a cube with a shader and quit on escape. However, at the line **`GLenum program = glCreateProgramObjectARB();`** it stops responding and closes. … | |
Maybe I'm just missing something but I was thinking what do you call something like a Windows Form Application in Visual Studio where you can drag and drop and stuff like that. Do you call that an API or SDK or GUI or something else? By the way, as I … | |
I'm going over a practice exam right now and I've come across something I can't figure out. I understand what incrementing is but I just don't know why the answer is 0. //What is the value of a after the following code is run (int a=12). a += a -= … | |
I made a program, hangman. And I am trying to complete it. I have succesfully been able to compare the input letter by all the characters of the word to be guessed (which is saved in an char array) and display it. But now, I can not figure out how … | |
I have my project due of hangman and it is worrying me lately. I need to make a hangman game. I have studied arrays, functions, loops, if else statements. That is about it. I haven't done 2d arrays. Will do it now, because someone told me it is not possible … | |
guys i have hw to solve but i cant solve this Q !! any idea? ![29](/attachments/small/3/29.JPG "align-left") ![29](/attachments/large/3/29.JPG "29") | |
can any one help to create an dynamic (2*10) two dimensional array using new and delete? which ask user to enter the value and fill both row and column? I am able to create one dimensional but unable to create 2-D. | |
It's useless. Why are stupid classes in C++ having private members for? [snip] I am never using OOP in C++ I'm just using structs to organize data fuck OOP and classes it's so ridiculous to me that I'm SMH | |
#include<iostream> using namespace std; int main() { int Partnumber[15] = {112,130,156,173,197,150,166,113,123,143,167,189,193,117,176}; int Quantitynumber[15] = {12,30,56,17,19,50,66,13,12,14,16,18,19,11,76}; int hashTable[19][2]; int collisions = 0; int index = 0; for(int i = 0; i<15;i++) { index = (Partnumber[i] % 19); hashTable[index] = Partnumber[i]; if (hashTable[index] != 0) { do{ index++ }while(hashTable[index]!=0) } if(index >= … | |
I've written a Rational Class that takes fractions and can add, subtract, multiply, divide etc. I'm trying to keep my fractions reduced but for some reason, some but not all of my fractions are being reduced. I've posted my code below. I commented the fractions that aren't being reduced as … | |
Hi, I have read this on IBM: > > An exception specification may only appear at the end of a function declarator of a function, pointer to function, reference to function, pointer to member function declaration, or pointer to member function definition. An exception specification cannot appear in a typedef … | |
Im trying to run a sipmple program in c++ using openGL but get these errors... can somebody please help me? Error 1 error LNK2028: unresolved token (0A00002D) "extern "C" int __stdcall __glutCreateWindowWithExit(char const *,void (__cdecl*)(int))" (?__glutCreateWindowWithExit@@$$J18YGHPBDP6AXH@Z@Z) referenced in function "extern "C" int __stdcall `anonymous namespace'::glutCreateWindow_ATEXIT_HACK(char const *)" (?glutCreateWindow_ATEXIT_HACK@?A0x6d0c8cb1@@$$J14YGHPBD@Z) c:\Users\SuranĂ©\documents\visual studio … | |
hello, acually your site is helping me alots , thanx alots I have an assignemt n i stuck on readind data from user and hendle them as single string plzzzzz anyone can help me:( i tried alots and alots Write a C++ program that will make use of the following … | |
I'm trying to implement a template class called "Tree", here is the code for the main function: [code=c++] #include "Stack.h" #include <iostream> #include <time.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int gameObjects = 0; Tree<Player>* PlayerTree = new Tree<Player>; Player** players; players = new Player* [5]; Player* … | |
Dear All, I have function that works like this. Here # represnts one word while * is for one alphabet. Can anyone help me changing this code where # is for 0-N words, means it works if at # there is no word between dots, while for * there must … | |
Hi, working on a piece of code which loads in two images, one is a scrambled version of the other, compares them and then attempts to make a new image from the scrambled version. So far I've got it making a new image, comparing and unscrambling most of it, just … | |
| I have a C++ application that I want to make more flexible and user-friendly. It currently contains seven nested for-loops, and part of the new flexibility is that this number will become variable (between two and twenty, say). What is the easiest way to achieve this? |
The End.