49,761 Topics
| |
[CODE] template <class T> class Llist //.... //Iterates to position and sets pointers to node at position-1 and position. template <class T> void LList<T>::iterate(Node<T>*& previous, Node<T>*& next, unsigned short pos) { //some code } //Start Iterator template <class T> inline Iterator<T> LList<T>::start() { //some code } template <class T> class … | |
In the last chapter of my book we implemented a simplified version of the vector class In the chapter I'm studying now we're implementing a simplified version of the string class ... which uses my version of the vector class (called Vec) to hold chars. [CODE]Str(const char* cp) { std::copy(cp, … | |
In a unix pthreads based app I'm working on, I have objects of a particular class (call it class foo) being created in multiple threads. I need a specific public method of class foo invoked at or after 60 seconds of the object coming into existence (it is not imperative … | |
So I am having trouble with the most popular error ever, memory access violation. To make a long story short I am dabbling with an old program I once wrote, it's main purpose is to parse some stuff and download some files. (It's too huge all in all so I … | |
hey I am new in C++ and I have finished my code but my Prof. asked me to write pseudocode and I have no idea what that is and I dont know how to write it. Can somebody give me some example how to write pseudocde from this code. [CODE]//This … | |
so heres the problem, i have been working on this asteroids game for a week or so now but i cannot for the life of me figure out how to work the direction properly. at the moment the only thing the ship does is move up the screen. The functions … | |
Hello, I have this assignment I'm supposed to deliver tomorrow, I have most of it figured out, but there are certain bits and parts of the question I can't figure out... I'll show you what I mean, here's the entire question: [CODE]Develop two linked lists to manage the list of … | |
The application has a screen size and resolution problem . What should be done since it looks very funny on desktops . | |
I am working on making a 'safetype' abstract class, which will have a complete set of pure virtual operator overloads to help make sure that a class inherited from it is safe to pass to virtual any function. The problem is that I don't know the syntax of a pure … | |
I'm learning C++ and just finished a tutorial on pointers. I understood what they were and how to use them but I do not understand when they should be used. When would it be practical to use a pointer to get a value instead of using the value's name? For … | |
I am a humble programmer who is about to lose his remaining sanity at trying to get FTGL and/or FreeType working with Visual Studio 2010. FTGL is version 2.1.2 and FreeType is version 2.4.4. Inside of the project directory I have freetype.dll and ftgl_dynamic_MT_d.dll, and I have linked to the … | |
Well I am coding a small intermediate program to help me with learning c++ , and i am wondering how to check for blank input to cin >> string heres what i have [CODE]string name; cout << "Enter You're Name: "; getline(cin, name); [/CODE] and if i just hit enter … | |
I am working on making an error header file and this is what I have: [CODE]#include <stdio.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <string> #define VANARGS(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n33,n34,n35,n36,n37,n38,n39,n40,n41,n42,n43,n44,n45,n46,n47,n48,n49,n50,n51,n52,n53,n54,n55,n56,n57,n58,n59,n60,n61,n62,n63,N,...) N #define __VA_NARGS__(...) (VANARGS(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)) #define ERROR(...) (\ (__VA_NARGS__(__VA_ARGS__)==0)?"NONE":(\ (__VA_NARGS__(__VA_ARGS__)==1)?(_1(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==2)?(_2(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==3)?(_3(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==4)?(_4(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==5)?(_5(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==6)?(_6(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==7)?(_7(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==8)?(_8(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==9)?(_9(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==10)?(_10(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==11)?(_11(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==12)?(_12(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==13)?(_13(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==14)?(_14(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ (__VA_NARGS__(__VA_ARGS__)==15)?(_15(__VA_ARGS__,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)):(\ … | |
I noticed that using a switch statement, the case always has to be a constant character or integer or it won't compile. It's sorta of a bummer as the only alternative is using a bunch of if/else if's. So doing something like this won't work: [CODE]switch(aString) { case "word1": doSomething(); … | |
I try to make an exercise that involves classes. I reached until this point [CODE] #include <iostream> #include<math.h> #include<iomanip> #include<conio.h> using namespace std; class Cplx { double re, im; public: //constructors Cplx(double x=0, double y=0); Cplx(const Cplx& z); //accessing the members double real() const {return re;} double imag() const {return … | |
I've been having a hard time understanding classes but i've got it mostly down(atleast I think) well below in the code I overloaded the + operator for my class called clr which uses strings, my problem is on lines 59 and 61(strcpy_s(tmp,len,other.buffer);) when I strcpy to tmp the word is … | |
Hi, I'm looking for a good book on Qt 4 programming, I checked both chapters and amazon but couldn't locate a Qt book with favorable reviews and was wondering if the daniweb members knew of a good text...Thanks in advance. Gerard4143 | |
My professor has thrown me a curve ball with this next assignment. The assignment is to make a Monthly Accounting Statement, the program is to you structs and arrays. I get how you can have an array of structs, arrays within a struct, etc... I have the program mapped out … | |
3 months ago me and my classmates played with visual c++ 6.0. We made a infinite loop of numbers that kinda looks like the matrix thing. We changed the font of the cmd of c++ to green. Now the problem is I can't turn it back to normal. I tried … | |
Input text file as an array? For example if the text file contained something like //names and grades Bob 98 92 66 90 Sara 88 75 39 85 Joe 92 99 99 12 Would it be correct to do [CODE] #include <iostream> #include <fstream> #include <string> using namespace std; void … | |
[code=c] void Assembler :: pass2(ifstream &inHandle, ofstream &outHandle) { outHandle<<setfill('0'); while(!inHandle.eof()) { inHandle.getline(src_line,50); //declerative or imperative statement if(toascii(src_line[0])>=48 && toascii(src_line[0])<=57) { breakStatement(); outHandle<<address<<")\t+ "<<mnemonicCode<<" "<<regCode<<" "<<setw(3)<<operand<<"\n"; } else outHandle<<"\n"; } } void Assembler :: breakStatement() { int i=0,j=0; char oprCode[20],oprClass; ifstream in; //initializing all variables strcpy(address,NULL); strcpy(mnemonicClass,NULL); strcpy(mnemonicCode,NULL); init(oprCode); regCode='0'; … | |
I am making basic project for "Computer simulations of polymers and biopolymers" using Monte Carlo simulation and I currently have access only to ASUS eee PC netbook. Could anyone run attached program on a faster hardware for input data [ICODE]100 50 50 1000000[/ICODE]. Last part of data is number of … | |
Can anyone please give me a guideline on how to code the following? I have an MFC application which should call on a timer basis a python script from command line and read the ouput of that command line. I thought of using CreateProcess, but i have no clue of … | |
I try to make an exercise from a book and I have only one error. On this line [CODE]cin >> t;[/CODE] it writes me that "more than one operator >> matches this operand" I know that defined this operand before in another way but I don't know how to solve … | |
I have two files; one with places then the distance between them. Example: Moffat Carlisle 65 Doncaster Hull 76 Northampton Birmingham 90 Leicester Lincoln 82 Sheffield Birmingham 122 I was wanting to use dijkstra's method, but i seem to have a problem because looking pseudo codes to understand it they … | |
I have trouble saving my numbers. I used an array for my saving feature. As you play the game, the computer asks you if you want to save a number. you say yes and you pick which number(s) you wish to save. My problem is, if i save 2 numbers … | |
I use CRT memory leak checking in my program, when it closes, it produces this output: [code] Detected memory leaks! Dumping objects -> c:\program files\microsoft visual studio 9.0\vc\include\crtdbg.h(1203) : {133} normal block at 0x003B6938, 4 bytes long. Data: < 5 > 00 00 35 00 c:\program files\microsoft visual studio 9.0\vc\include\crtdbg.h(1203) … | |
What are the purposes of using ifndef and define? When should it be used and why? I made a simple program in class just to go over the basic of Friends in classes but it wouldn't work and I was getting errors all over even though I went through it … | |
[QUOTE]programing turbo c[/QUOTE] how can i make a moving name program going round and round my monitor in turbo c and i need this 5 days from now! | |
The problem for my CMPT103 class is to write a program that takes a binary number as an integer and returns it as a decimal, i would be able to do this easily by taking it as a charecter array and dealing with each individual element but i dont understand … |
The End.