sorted linked-list

3042 byte By lmpb17 at 2007-11-20 11:18:44
I have an assignment for class to write a sorted linked-list. The way our teacher wants it done is for the list to be deleted everytime a new number is added and a new sorted list to come out. This is what I have right now but I can't get it to save the list because Im putting the clearList() f...

Issue regarding template speciliazation

1697 byte By goutam_nit at 2007-11-20 11:18:57
Hi,I have the following piece of code (at the bottom). When i try to compile the following code i get an error ( error: specialization of 'HRESULT MakeSimple<PrimT>::marshal1(SimpleStream *) [with PrimT = double]' after instantiation error: invalid function declaration ) if i put th...

Fast variable length array

1010 byte By LoneRanger at 2007-11-20 11:19:02
HiI'm trying to find a fast way of implementing a variable length array. I have a large array of fixed length that I new up using the standard new operator. The data contained in each element of the array must be a variable length array ( so essentially this is a two dimensional array). I must...

[RESOLVED] singleton constructor called twice, Instance function even more times

2020 byte By myhanguk at 2007-11-20 11:19:06
Hi,I created a class using the singleton pattern, but it fails to work as a singleton...My code is as follows (the bp(..) functions are just displaying breakpoints at positions of interest).#ifndef _STAT_H#define _STAT_H#include "macros.h"#include "basic.h"#include "fixed_defs.h"#ifdef CHECK_SATURAT...

Prime Number Program help!

595 byte By neverknowsbest at 2007-11-20 11:19:43
Hey everyone I hope I'm posting this in the right place...Ok so I'm a student and I'm currently in C++ I. My teacher wants me to write a program to print to the screen every prime number up to the number that was inputted in.The catch is that I have to use an Array and "%"Also I only...

Banker rounding:

900 byte By Kane Nathaniel at 2007-11-20 11:19:49
How would you write a code for it?My teacher doesn't even know C++ so she can't even help us on the homework...Makes me wonder why she is teaching a C++ class.Well here is banker's rounding if you don't know what it is:Bankers rounding: Round as usual unless the third digit is a...

need help opening n number of data files to be manipulated

1059 byte By dalearyous at 2007-11-20 11:19:54
i guess i just need conceptual help on this. i need to be able to ask the user how many files they would like to open (n). then prompt the user to input the filename (text file) n times each time reading in a different data file. here is where i don't know exactly what to do. my first instinct...

Help a dying man...function prototypes

1168 byte By frasifrasi at 2007-11-20 11:19:57
So, I am having a LOT of trouble with function prototypes (calling a function) and passing by reference...Basically I have a main function and another function in a separate file. When it gets time to call the function, I want to send an x value and the ofstream outData. Basically, I opened an input...

Updating ASCII files in c

433 byte By gstavrin at 2007-11-20 11:20:03
HiI have to write a program in C, in which I need to open a text file for reading and writing. I want to insert in the text a string as a new row, between 2 existing rows. The problem is, when I use r+, w+ or a+ as arguments in the fopen function, I cannot perform properly the above action, without...

color: identifier not found

2761 byte By 4fingers at 2007-11-20 11:20:07
Hi everyone,I have this book which explains this code nicely all except when it comes to defining the colorextern float spline(float x, int nknots, float *knot);#include <iostream>#include <string>using namespace std;#define CROO -0.5#define CR01 1.5#define CR02 -1.5#define CR03 0.5#defi...

two level inheritance

312 byte By musicalhamster at 2007-11-20 11:20:08
Hi. I'm having trouble accessing a variable stored in a third level base class.ie,Class AClass B : Class AClass C : Class BMy trouble is accessing a variable defined in A from C. The variable is not overwritten, but my error message says it is inaccessable.Any ideas?...

help with pointer arrays

244 byte By RedOctober45 at 2007-11-20 11:20:11
is there a C/C++ function that I can copy a char array of a pointer to another char pointer but instead of defining a numerical stopping point (like strncmp), is there one that will stop copying like say at the NULL character?<br/>thanks!!

whats the point of ptr-to-ref?

786 byte By ahoodin at 2007-11-20 11:20:13
What is the use for ptr-to-ref?CG article describing ( http://www.dev-archive.com/cpp/cpp/cpp_mfc/pointers/article.php/c4089/#3) I found this article, but when it comes to pointer to reference *& it is shall we say unprecise in the descriptions and the purposes of its use.It appears to be used just l...

char array copying

346 byte By RedOctober45 at 2007-11-20 11:20:15
What's the best way or function to copy one pointer char array to another, but they are different sizes. I have one that is 200 bytes but I only wan t to capture the first 30 and put in a differet array. How can I do this?edit: or is there a way to copy only till a specified delimiter, other...

how to delete specific elements in a char pointer

446 byte By Priya_Sundar at 2007-11-20 11:20:31
Here is the declaration statement.unsigned char *GuidString;Now i have made GuidString point to "{A89377EA-D4ED-4A03-A37F-4A9DE785E1A9}".Here i need to delete the paranthesis, i.e, i need to delete the first and last character in GuidString.How to make it point to a val of just "A89377EA-D4ED-4A03-A...

while loop

956 byte By kb8coolj at 2007-11-20 11:20:37
hi! i needed to know whether anyone knew how to code this so that it will skip over the white spaces in a file. mdefn is a string and it is reading from a file with a line of whitespaces. so basically what it is doing is just retaining the last word before the # sign which is my sign to end. I canno...

A little help with recursion...

6209 byte By Illbred at 2007-11-20 11:20:39
Hi all, I am writing yet another recursion program for an assignment. In this one we are supposed to recursively count the number of domino tiles that an cover a certain board. I am at the point in the program where I am just trying to get it to figure out how many vertical domino tiles I can place...

printf question

95 byte By RedOctober45 at 2007-11-20 11:20:46
If printf is outputting a string, does it stop doing so at the NULL character?<br/>Thanks!

is this legal?

249 byte By RedOctober45 at 2007-11-20 11:20:51
are these statements legal?<br/>char* temp = NULL;<br/>temp = new char[5];<br/>temp = "Hello";<br/>I am mostly converned if the last one is allowed or not, it seems to work for me in Linux with gcc but not MS VS 2005.<br/>Thanks!

Does someone help me to corect my ultoa function

711 byte By Xiaolei Shang at 2007-11-20 11:20:52
Hi guys:I want to write the function ultoa(unsigned long l, char* pStr, int base), which is to convert any unsigned long number to string of base "base". The code that I wrote as following:void ultoa( unsigned long l, char* pStr, int base){ char tempUse[1]; unsigned long remainer; if(l<base) { s...

C++ cin - help plz

271 byte By RedOctober45 at 2007-11-20 11:20:55
I am using 'cin' to grab string from command prompt into a char* array. The char* is initialized using "new". It seems to work but is it good practice? Is there any details such as mem corruption that is going wrong here? If so, how can I fix this? Thanks!

local variables and scope - help plz

162 byte By RedOctober45 at 2007-11-20 11:21:00
Do local variables leave scope when the function is done? <br/>By using the MS VS 2k5 debugger, it seems that they do but I want to verify.<br/>Thanks!

help in teaching templates in c++

152 byte By vasayarizwan at 2007-11-20 11:21:09
hello it's rizwan from bhavnagar studying in tybca . i want to learn how to create templates in c++ . please help me out by giving a small example.

UNIX: fopen and the tilde ~

684 byte By kenrus at 2007-11-20 11:21:18
I am not able to open a file on AIX UNIX when I use the '~' symbol.FILE* hMyFile = 0;hMyFile = fopen("~/.MyHiddenDir/MyFile.dat", "rb"); /*FAILS*/if(!hMyFile) hMyFile = fopen("/home/kendallr/.MyHiddenDir/MyFile.dat", "rb"); /*WORKS*/if(hMyFile) printf("\nFile Open Succeeded");Is the...

Unique Identier - Best solution

608 byte By Kartal10 at 2007-11-20 11:21:22
Hello All,Im doing a project where I need a unique identifier (an integer) for a message that will be sent over a socket. When the message has been created and sent I want the unique identifier to increment by 1. This will be implemented as a service, if the service stops for some reason and restart...

Saving a "bmp" file

6 byte By style at 2007-11-20 11:21:24
Hello.

How to pass char array values to another function using Call by value in C++?

536 byte By jaiganeshbe at 2007-11-20 11:21:30
Hello all,I have tried to pass character array from main( ) function to getAddress () function using call by reference.But unforunately i have done some modification in that array.So original value was changed.Now I have to use call by value to pass my array from main () to getAddress.Is it possibl...

How to skip bad data...

370 byte By frasifrasi at 2007-11-20 11:21:38
I have this code that reads numbers from a file line by line and if the data is bad, it outputs "Error" on that line. The problem I having is that once it reaches bad data (in this case, the characters "abc" instead of an integer), it outputs the error but does not continue on to the next number on...

dev compiler?

424 byte By pouncer at 2007-11-20 11:21:40
Hi guys, my college uses the dev compiler for C++, I have Visual Studio at home for my C++.I want to switch to dev. The way we current compile our C++ files at college is by command line g++ 0 file file.c (something like this, can't remember the exact format)Anyway, I'm looking for some in...

Indexing an excel file

1220 byte By karunakarchatla at 2007-11-20 11:21:48
Hi,I have a pretty large excel file with some useful information. The columns of the file are: ID, Note and User. ID is given once and Note and User can repeat any number of times. For Example :ID1, , ,NOTE1,USER1 ,NOTE2,USER2 ,NOTE3,USER3 . ....

Template specialisation with template template parameters

1944 byte By the4thamigo_uk at 2007-11-20 11:21:57
Here is the guts of my problem. I dont seem to be able to use the template template parameters TT1, TT2 & TT3 to specialize my member function Container:: object(). Basically I want to use them in order to select thecorrect member variable index1_, index2_ and index3_ as this presents a nice Tag...

Class Problems Segmentation Fault

2054 byte By patrickglass at 2007-11-20 11:22:03
Hello,I am new to C++ programming. I am working on Fedora and compiling iwth g++. I think the best way to see what is going on is to download the file and look at it.SSHConnect.cpp <-- my class definitions (THIS IS WHATS NOT WORKING)autoSSH.cpp <-- driver program for testing the class ( fails...

Data type question

284 byte By Campuschris at 2007-11-20 11:22:07
Im attempting to store a number into a variable, but I need a variable that would go high enough to store it. :-\<br/>10^16<br/>or<br/>100,000,000,000,000,000<br/>I've heard of C having an unsigned long long int, but does C++ have anything that could hold it?

List dir files check file creation date

3579 byte By knightzor at 2007-11-20 11:22:13
Hi allI'm trying to get this code to read the files in a directory (this works ok as is now) and then check the creation date (specifically the day of the month) of each file. This info will then be used to compare the creation time with the current day of the month, depending on the result the...

Problem with vector. behaves strangely...

2165 byte By Spaesee at 2007-11-20 11:22:24
hi guys, before i start describing the issue heres what i am usingI am using the 'VisualAge C++ Professional / C for AIX Compiler, Version 6' to compile/build my applications and i am running it on a AIX 5 machine.I have a program that reads tab seperated numeric values from a file an...

need help with simple program

2233 byte By Keith84 at 2007-11-20 11:22:38
hi guys, need advice on wad i need to do for my current school assignment..im suppose to create a hangman game and its suppose to look roughly like this..1st of all i have managed to get the program to point to the txt file with 20 words for the user to guess in the file.If user enters a number 3, t...

Array problem in C++

1627 byte By Garan at 2007-11-20 11:22:59
#include <iostream.h>using namespace std;void binary(int number);int main() { int b; for (int x = 0; x < 256; ++x) { binary(x); if (x < 128) cout << " " << x << " " << x <<endl; else cout << " " <<...

Even/Odd Numbers? :D

114 byte By Kane Nathaniel at 2007-11-20 11:23:11
I need help determining if a value is even or odd using for statements.<br/>I don't even know where to start.

Classes, probably a very simple answer is needed...

5820 byte By X-ed_Out at 2007-11-20 11:23:12
I have the following functions in a class defined by me, the class is called Rede and in its private area has the following variables:private: bool **Matrix; //bool M[][]; int width, height; //unsigned- sem sinal pois nao poxo ter valores negativo char filename[256];// nome do ficheiro ofstream file...

Beginner needing help 2

2813 byte By yasoumalaka at 2007-11-20 11:23:13
Hey guys how you all doing. Last time I was here I got some great help with a very newbish program. Well I'm writing another one which is required for class but again I want to take it further to learn more c++ here it is.#include <cstdlib>#include <iostream>using namespace std;usin...

can someone help me with special characters?

354 byte By SILVER_SK at 2007-11-20 11:23:19
hi , am a student with an assignment to be done on the c++ console , i having a bit of a headache with special characterswhat am trying to do is to make the program display : X1+X2+X3with the 1 , 2 and 3 in sub script, is there anyway to do this in a c++ console app?in other words i want to display...

Template like function with polymorphic behavior issue

1151 byte By mcmancsu at 2007-11-20 11:23:20
I have something of the following which utilizes templates. But since the data member of the vector is a polymorphic base object, it would be much preferable to NOT have the function templated. The catch is that I would like to instantiate the polymorphic object within the function:class Base {pub...

too many initialing..

309 byte By Rooting at 2007-11-20 11:23:22
hi friends..programming a software and the end visual c++ showsthos error"Too many initialing "at this array..char array1[MAX] = {"1110", "330", "440" };I need to call anyone whith a declaration like thisarray1[3]how can i resolve??..thanks!!.....

C Help

3495 byte By cuba06 at 2007-11-20 11:23:26
I was told to write a program that would calculate the total resistance of a resistor, based on the inputs of the user.When I tried to add a terminate program key, it is not working properly. It will let me input the number, in this case, -1. When I hit enter, it will not terminate, but simply ask m...

array of class instances

665 byte By pyrotechnic at 2007-11-20 11:23:29
I have an array of instances of a class. I initialize a limit of 5 because i want a maximum of 5 of them at one time. I want to be able to, when a new one is to be created, store it to the array in the first avaible spot. The problem is I don't have much experience in that regard. So the part I...

Associative Array Template to act like <MAP>

5289 byte By aBoy at 2007-11-20 11:23:32
Hi. I am a student. My task is to develop an associative array template class that works like the STL map container. Achieved through a template and some operator overloading.I have no trouble getting a standard 2D array template to work fine, however when trying to incorporate the second type into...

Array in a singly linked list

602 byte By *Sweetheart* at 2007-11-20 11:23:44
Hi there!the thing is that I have to implement an array in a linked list. I mean the idea is an array but in C++ it should be a singly linked list. I need 2 methods, for example:void set(int, char) char ask(int)What I understand so far is that in the set method I need to count a given number of step...

Reading a sequential file into memory (in C)

2507 byte By gstavrin at 2007-11-20 11:23:55
Hi allI have to implement a program in C which must use 2 given functions append() and read_line(), so as to read an ASCII file into memory.The file must be stored line by line into a 2D array. The append() function appends a character that has been read from the file to a specified line of the arra...

class help.

2255 byte By jrice528 at 2007-11-20 11:24:03
For homework i am suppose to use 3 member functions flip, getHeadCount, and getTailCount. Anyways i think i got most of the code, but the heads and tails arent coming out right. Any help is REALLY appiciated. TThis is first program with classes so go easy on me.Sorry for the lengththe code for the c...

A REALLY Dumb Question

336 byte By TSYS at 2007-11-20 11:24:04
Either I missed this class in Elementary Programming, or perhaps Mary-Jane had her see-through blouse on, but I'm at a loss for this: What format string would I use (eg., in a printf() call) to right-justify a number with blank fill?For example, if the number is 12 and I have a 4-character fiel...