49,766 Topics
![]() | |
I have got this class:[CODE]class sample{ private: int number; string adress; public: int get_number(); string get_adress(); sample(); ~sample(); };[/CODE] I allocate dyanmically memory space like this(cause i need an array of pointers to obects):[CODE]sample** samples; samples=new sample*[20]; for(int i=0;i<20;i++){ samples[i]=new sample;}[/CODE] My question is how can i sort this array … | |
Hello all, I have my assignment topic and I know what information I would like to include in my assignment. Can anyone tell me how to put my data into top-down format? Here is what I have thus far: I'm trying to design a program that will input ages of … | |
Hey everyone. Some back info : I have been developing in C for about a year now on and off. Recently I grabbed myself a C++ book and am progressing at a steady rate. Up until recently I have been developing small applications and done a lot of ports. Wolfenstein … | |
hi, I'll be greatful if someone tell me how to declare the preiority queue in c++ and also tell me the syntax that how we can put a node in a preority queue. Regards Zain | |
MattyRobot as you may know him, gave me the code to make a new window, but it opens up cmd window too. I would like it so the window opens only. If anyone knows the code, I would be more than happy to find out | |
[CODE=C++] /* I'm stuck! Here is what I consider to be a perfectly running program that uses an array ( TArray ) template to hold arrays of objects. Its just about your classic text book example. Its pretty well stripped down to nothing to illustrate my problem. I simply don't … | |
Here's the code that increases x value by 0.01 increment and outputs: x, placeholder for initial x+t and how many loop cycles it took to find a solution to the equation in function f1() in intervals for temp (0.5 ; 1.0)U(1.0 ; 1.5). [code] #include <iostream> #include <cstdlib> #include <cmath> … | |
Is my understanding of a vector list correct. vector<list<int>>. The vector holds a list of data type int? [CODE] class my_ht_chain { public: //constructor which creates a table of a certain size my_ht_chain(int size); //destructor ~my_ht_chain(); //insert a value based on key void insert(int key); //search for a value based … | |
I have trouble understanding the compilers. The following code does work in UNIX under g++, but under VC++ it would not even compile. Anyone can provide valid reasons why? [B]Code:[/B] [CODE]#include <stdio.h> #include <iostream> #include <string.h> using namespace std; int main() { string tmp_nw_msg, crc_chksum, buffer; cout << "Enter the … | |
My program takes numbers from a .txt file then puts it in, so that an array has a "bacteria" in it. The "bacteria" will die if it has 4 or more, or if it has 1 or less. It will live with 2-3 neighbors. If an empty cell has three … | |
Just got back to my interrupted attempt to pick up C++, and I'm already shipwrecked again. Anyway... I'm trying to build another bitty app from my text, but nothing seems to be coming together properly. The program should ask for an array length, send that to an input-handling function, then … | |
It is possible to choose template parameter in runtime? when i try to construct an object wich has template parameter | |
hi!!! im a new member of this organization of the IT's. im a freshmen student ,takig up IMFORMATION TECHNOLOGY and i have a problem regarding how to make a calculator using SWITCH CASE, i've tried to make a program of that using other functions and it made it successfully but … | |
hello, I'm a computer science student. I'm starting to get into the more challenging aspects of C++. Where can i find a good website for quickly finding syntax. Say i want to solve a simple problem, but i don't know the exact syntax, where can i quickly find code snippets … | |
Do I need a copy constructor? [CODE] #ifndef MY_MIN_PQ_H #define MY_MIN_PQ_H #include <iostream> #include <vector> using namespace std; class my_min_pq { public: //default constructor my_min_pq(); //destructor ~my_min_pq(); //insert element at end of sequence, and rearrange so minimum data at the front of array void enqueue(int data ,int priority); //removes data … | |
I have this code for a tic tac toe game, it`s not done yet, and what I have done isn`t working like I want it to. The screan prints and promps player 1 and 2 for inputs one at a time, but my while loop in main is probably wrong, … | |
I am a beginning c++ student and need to read in a text file as shown below: [code=text] Orvilles's Acres, 114.8 43801 Hoffman's Hills, 77.2 36229 Jiffy Quick Farm, 89.4 24812 Houston Bayou Texas Home Grown Popcorn Inc., 124.7 65687 [/code] The criteria is to read characters to comma then … | |
hey guyz how r u?? plzz i rly need ur help with this 1.. coz i dnt know how 2 writ it..:( Writ a program estimate how much a young worker will make before retiring age of 65. request the worker’s name, age, and starting salary as input. Assume the … | |
I have to write a function to populate a 50 element integer array with random numbers: 100 <= # <= 1000. I have everything I need in the code except the "between 100 and 1000." The things I'm trying are not working. Thanks! [CODE] #include <iostream> #include <cstdlib> #include <ctime> … | |
I'm using Visual Studio 2005. I tried to adapt the existing class for the binary search tree (from my book) to a template and mostly it works, but I'm getting errors related to the insertNode and deleteSubTree functions when I try to build it. The header file: [CODE] // Specification … | |
Hi and I have just downloaded the Irrlicht gaming engine and although I have had a briefing about it from a friend I can't seem make it do what I want. I got the demo which is nearly what my result will look like but then I tried switching from … | |
we are supposed to implement using STL vector and base it on priority and have have a data value So every time i enqueue i insert an in item into the end of the vector and if no space i modify. So do i reorder the list to place the … | |
Hello all, I am trying to write a clustering algorithm where, given location of certain points (I.e, latitude and longitude) I need to choose 50 of these to be cluster centers such that the diameter of each cluster is minimized. To that end, I believe that the program should choose … | |
it builds correctly and runs correctly but when the program gets to the while statement, it just stops completely, does not even allow blind input of data. I know it is a little messy but here is the code: [code=c++]// buildingwillcost.cpp : Defines the entry point for the console application. … | |
For some reason when i'm trying to declare a float function it gives me this error. But if i declare a void or any other type of function it works... any ideas? THANKS!! [CODE]#include <iostream> #include <cstring> #include <iomanip> using namespace std; void inputInfo(float *** rawScores, char names[ ][50], int … | |
I am trying to find a way to find a median of individual parallel arrays, but I'm not sure how to start. One question I have, though....is an array the same as a list? I was told that it might be easier to do a bubble sort of a list, … | |
I have an alarmingly strange situation. I fill my map with const char * and int values. When I try to "find" the one I want, it says it's not there. Here's the short version: [code=c] // tempText = "socialize" for( actionIter =actionMap.begin(); actionIter !=actionMap.end(); ++actionIter ) { if ( … | |
So I can crop an image in cariomm and display it to the canvas, but what I want to do is crop the image and save the cropped image to a Cairo::ImageSurface so that I can paint just the section of the overall image to the screen with out have … | |
I'm trying to move one big C++ string (with separators) like one below [CODE] & 12345 & 12345 & 23423 & 90323 & [/CODE] into 3x5 array like one below with the first group of numbers excluded char array[3][5]; [CODE] { '1' , '2' , '3' , '4' , '5'} … | |
I need help cause i dont know how to use an array of pointer to classes. I've got in my main this: [CODE]gramma** letter;[/CODE] I have in an other class named classA this: [CODE]gramma** grammata;[/CODE] I construct in my main like this: [CODE]letter=new gramma*[number]; for(int i=0;i<number;i++){ letter[i]=new gramma(arithmos,&array);}[/CODE] What i … |
The End.