49,760 Topics

Member Avatar for
Member Avatar for stemiros

Hi, I have a list of base types which stores multiple derived types. The following code shows a simplified setup. [CODE]#include "Base.h" #include "DerivedA.h" #include "DerivedB.h" #include <iostream> #include <list> void main() { std::list<Base*> base; std::list<Base*> *basePointer = &base; for (int i = 0; i < 10; i++) { basePointer->push_back(new …

Member Avatar for mrinal.s2008
0
2K
Member Avatar for geekme

Hello, for a project on network simulation I need to show graphical representation of the graph.Which library files can I use for the purpose?Should i switch to OpenGL.I know nothing about graphics in C++ right now.Please help. Regards.

Member Avatar for mike_2000_17
0
130
Member Avatar for Chris11246

Im trying to install the opencv libraries and i tried following the instructions at: [URL="http://blog.cuvilib.com/2011/03/22/how-to-build-opencv-2-2-with-gpu-cuda-on-windows-7/"]http://blog.cuvilib.com/2011/03/22/how-to-build-opencv-2-2-with-gpu-cuda-on-windows-7/[/URL] but Im having problems getting the sample code to compile. When I try: [CODE]#include <iostream> #include <opencv2/opencv.hpp> #include <opencv2/gpu/gpu.hpp> using namespace std; int main() { try { cout<<cv::gpu::getDeviceName(0); } catch(const cv::Exception& ex) { std::cout << …

Member Avatar for rubberman
0
276
Member Avatar for fadi_1234

[CODE]#include <ctime> #include <cstdlib> bool winner = false; winner = true; srand((unsigned)time(NULL)); comp_choice = rand() % 3; system ("PAUSE"); return 0; } [/CODE] How to transform this idea or this codes to simple codes in IOSTREAM Library

Member Avatar for rubberman
0
105
Member Avatar for jowana

I have a main function and I want to call another function inside my main, but it gives me an error like this: error C2601: 'ComputeCentroid' : local function definitions are illegal I know that this is an error because the '{' for my main is still not closed before …

Member Avatar for WaltP
0
201
Member Avatar for WhiZTiM

First of all, I'm 17 learning C++ on my own! I've been enjoying Daniweb. and I did like to thank the community for that! Thank you all! Here goes my Problem... I have a small program that calculates time between two instances and it worked fine... so I decided to …

Member Avatar for WhiZTiM
0
289
Member Avatar for PaulBird

ok, so i want a program that just says back to the user their input. the users input will be more then one word, so there will be whitespace. when i use string as a class for the input, then it only gives back the FIRST word of the input.... …

Member Avatar for frogboy77
0
250
Member Avatar for andimiami

Ok, so my program complies (not that that means much, haha), but at least I can now SEE that something in my loops isn't right. I need to take my 2-dim array file input of 4 students with 3 quizzes, which looks like this: (the asterisks are whitespace) 10**10**10 *2***0***1 …

Member Avatar for WaltP
0
209
Member Avatar for MIGSoft

Hey Everybody, I keep getting these warnings when I compile my program: 19: warning: extra tokens at end of #ifndef directive 19: warning: missing whitespace after the macro name both apply to the same line number, which has nothing to do with the ifndef statement. I tried looking for an …

Member Avatar for Leon_Alone
0
274
Member Avatar for caltech

Trying EVERYTHING but I don't know what the *heck* I'm even supposed to try because there shouldn' tbe a *bleeping* PROBLEM. The file is being opened fine, I guess, because I tried changing the file path and then got an error. It's just not reading the DATA. THERE'S NO REASON …

Member Avatar for VernonDozier
-7
244
Member Avatar for dyingatmidnight

Hello all, I am currently in the process of learning C++ for a work term position I am on. After hitting a wall trying to teach myself from books I decided it might be easier to translate some old Java programs from school into C++ to get a better understanding …

Member Avatar for dyingatmidnight
0
323
Member Avatar for myk45

Hello everyone, i'm having some problem with the following code: [URL="http://pastebin.com/KTKaVje8"]CODE[/URL] inputSouce is an abstract class and the rest are derived from it. The definitions for these are elsewhere. Now, [CODE]inputSource *irSources[4]; irSources[0] = new irSource(); [/CODE] This is giving me errors. i'm using VS2008. [B]error C2466: cannot allocate an …

Member Avatar for myk45
0
174
Member Avatar for smitty34

[CODE]// Finals.cpp.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <string> #include <iomanip> using namespace std; // //CLASS DECLARATION SECTION // class EmployeeClass { public: void ImplementCalculations(string EmployeeName, int hours, double wage); void DisplayEmployInformation(void); void Addsomethingup(void); string EmployeeName; int hours , overtime_hours, iTotal_hours, …

Member Avatar for SgtMe
-1
125
Member Avatar for Ninjaboi

Sorry if the title is a bit off, I couldn't think of what to call it. I've created projects in VS, and they all run perfectly fine. However, I now just want to create the source files then compile via the command line. I've done this rather easily, but now …

Member Avatar for Ninjaboi
0
135
Member Avatar for app08sfs

Hi there, I've got a question to ask regarding Hamiltonian problem. I'm doing on a simple question below: State equations ODE:- [TEX]dy/dx (t) = x2(t)[/TEX] [TEX]d^2y/dx^2 (t) = -x2(t) + u(t)[/TEX] ....where u is a control. Initial condition [TEX]x1(0)=0[/TEX] and [TEX]x2(0)=0[/TEX]. We try to minimize [TEX]J(u) = \int\limits_0^{10} [y1^2(t) + …

0
61
Member Avatar for bentring34

Is it difficult to turn games like [URL="http://www.clarendongames.com/product.php?xProd=3&xSec=2"]Perigon[/URL] that have been written in C++ for iPhone into games for PC?

Member Avatar for Fbody
0
97
Member Avatar for skatamatic

Well I don't have any specific question. I've been writing a chess game and can't seem to figuire out what the problem is with it! I tried debugging it for a few hours now and am about to give up altogether and rewrite it. The problem occurs seemingly randomly when …

Member Avatar for robab
0
166
Member Avatar for duskofanera

i have two projects on visual studio 2005 one in vc++ & other in vb.net now i want to both programs to work cooperatively acc to me i have following ideas but dont know how to implement them 1 - if i create third project and integrate/merge/combine other two in …

0
112
Member Avatar for Rishikeshan

I am trying to dump the memory of my c++ app. [code=c++] #include <iostream> #include <fstream> using namespace std; int main () { ofstream myfile; myfile.open ("example.txt"); myfile << "Writing this to a file.\r\n"; myfile.close(); int *p; *p = 25; char b[] = "hello"; int a; for (a=0; a==-1; *(p++)){ …

Member Avatar for Rishikeshan
0
269
Member Avatar for ekailan

I have 5 programs that works 100% I need to integrate them in one code using this code in the main [CODE] int A; cout<<" Enter Your Choice"; cout<<"1. Algorithm A ."; cout<<"2. Algorithm B ."; cout<<"3. Algorithm C"; cout<<"4. Algorithm D"; cout<<"5. Algorithm E"; cin>> A; if(A==1) { //call …

Member Avatar for ziggystarman
0
137
Member Avatar for Deepo

Hey everyone , I have a Mid semester Exam next week and I need to study the basics of programming a C++ programs. can anyone recommend or help me with some basics or link me something which could help me revise things faster and make it easier. i am sturggling …

Member Avatar for jonsca
0
218
Member Avatar for taumang

this program does not read display smallest and largest values in order [ICODE]#include<iostream> using namespace std; int main() { int sum; int product; double average; int x,y,z; int largest; int smallest; cout<<" Enter Three Integers of your Choice "<<endl; cout<<" *********************************** "<<endl; cin>> x >> y >> z; cout<<endl; smallest …

Member Avatar for gl7
0
3K
Member Avatar for kchyn

Hi, I'm programming something for a micro-controller and I need a compiler that can turn c++ into .bin Anybody have any idea where to get one?

Member Avatar for ziggystarman
0
362
Member Avatar for kao

Firstly, apologies for the lack of commenting, it will be commented when the program works properly (lol), I'm creating a program which creates a test harness for 3 subjects, employees. This will display their name, ID and payrate per hour, it will then calculates the total amount in 37.5hours. Again, …

Member Avatar for rubberman
0
75
Member Avatar for jimJohnson

I was working on this program a year ago and wanted to check something on it but I have some errors on it and was wanting to know if someone very knowledgeable and take a look at this and offer me and advice to make it run. I get some …

Member Avatar for mike_2000_17
0
149
Member Avatar for hawita

Please help how do i do this program?? i have only two more days before it is due :( Write a program to read data from a large text file. Within the file, the data are arranged in two columns, separated by white space characters, and comprised of a variable …

Member Avatar for abhimanipal
-3
128
Member Avatar for MasterGberry

Made a small project to help compare two files that I am testing...but for some reason the line I highlighted isn't working as its supposed to. I originally had [CODE]c1 != c2[/CODE] and then changed it to [CODE]!strcmp(c1, c2)[/CODE] Maybe its a dumb logic bug, but would appreciate some help …

Member Avatar for WaltP
0
109
Member Avatar for figment56

Hello All: I searched through the old posts, but could not find an answer as how to read numbers from a sequential text file & calculate the average of the numbers. Do you place the calculation to find the averages outside of the loop to read the text file? If …

Member Avatar for WaltP
0
165
Member Avatar for mark103

Hi guys, I am new on this forum and I would like you to help me out regarding to the actual errors that I have got. I am using managed c++ as I have switched over from vb.net, however I need your help because I couldn't figure out the solutions …

Member Avatar for sergent
0
249
Member Avatar for scarlettmoon

Hi ~ I am getting a strange [B]RunTime Error[/B] while debugging my code. Run-Time Check Failure #2 - Stack around the variable 'player' was corrupted. Code is below. Would love some help on this one. Thanks. ps ~ I realize that system("pause") is frowned upon but it is what we …

Member Avatar for scarlettmoon
0
130

The End.