49,755 Topics

Member Avatar for
Member Avatar for OffbeatPatriot

I'm making a game and the game works around a class I call Cyber_State. Every state of the game is a subclass of Cyber_State, for example the title screen you see when you start the game and the actual game. Every state has a member that is a pointer to …

Member Avatar for MrSpigot
0
97
Member Avatar for daviddoria

On the line [code] set<T>::iterator iter; [/code] I am getting "expected ';' before 'iter'" [code] #include <vector> #include <set> using namespace std; template <typename T> vector<T> UniqueElements(const vector<T> &V) { set<T> s; s.insert(V.begin(), V.end()); vector<T> Elements; set<T>::iterator iter; return Elements; } [/code] Can anyone see why? It compiles fine if …

Member Avatar for daviddoria
0
97
Member Avatar for C++ Obliviator

I'm working on a rather big program. Everything works fine:) , until I added this simple code: [CODE]int counter_x = 0; int* x = new int; for (int a = 1; a < plain_len; a++) //plain_len: int { int b = a; while ( b != 0 ) { x[counter_x] …

Member Avatar for C++ Obliviator
0
587
Member Avatar for CPPRULZ

My textbook says "Constructors cannot be virtual. (Think about it: constructors are called to create new objects. However, if you don't know what type of object you're trying to create, how do you know which constructor to invoke?)" but I am not sure what it means by this. Is it …

Member Avatar for ArkM
0
139
Member Avatar for TheFueley

Hello all, I am trying to make a linked list (class-based). I'm not sure if I went actually did it right. I get a compiler error on the segment of code that deals with printing the linked list to stdout. Here is the seqment in question. [code=cpp] // print contents …

Member Avatar for TheFueley
0
173
Member Avatar for Justmehere

What I wanted to ask is if its possible to insert a Combo Box inside a Splitter window ? I am not sure if this question is incorrectly posted in this group. Any resources would be greatly appreciated.

0
58
Member Avatar for CPPRULZ

Hello I have been trying to understand virtual functions for a while and when I made a program to demonstrate the use of virtual functions it didn't and someone gave me this piece of code that would demonstrate the proper way to utilize a virtual function: [code=c++] #include"derived.h" #include<iostream> using …

Member Avatar for CPPRULZ
0
123
Member Avatar for Technosapo

Hello Everyone. Having some problem with coding, and hoping that someone could help. I have a text file with input delimited by spaces. Something like this: TGP C 18 3.90 4737 JWW B 25 6.5 9630 Now I can open and read the file. Now I am trying to get …

Member Avatar for Ancient Dragon
0
121
Member Avatar for guest7

Hi, I am getting the following error when I am trying to initialize a 2 dimensional vector with 0's. I am not to figure out the reason. Any help is appreciated. [ICODE] std::vector<int> truth_table; std::vector<vector<int> > truth_table_col; double no_of_twos = 7; double base_two = 2; cout << "No of 2's …

Member Avatar for guest7
0
99
Member Avatar for iTsweetie

Hi again! I'm having problems with an assignment once again. It's asking us to write a program that takes in a phone number as a string in the form of (555)555-555. We're then to use the strtok_s function to split the phone number into the area code, prefix, and then …

Member Avatar for Ancient Dragon
0
133
Member Avatar for Argo54325

Hello, I'm working on a school project, and I'm so lost i can't even figure out how to start it. What I'm trying to start off with is just a simple console application that gets these settings: program.exe [switch] [path] [filespec]. how can i accomplish this? This is what i …

Member Avatar for Argo54325
0
159
Member Avatar for Hilariousity

Hi there! I keep getting an error stating error: expected unqualified-id before 'bool' when I try to compile this file [code=C++] #include "Data.h" #include <iostream> Data::Data() { } Data::Data(char aLetter, int anOrder) { letter=aLetter; order=anOrder; } Data::~Data() { } ostream& operator<< (ostream& out,const Data& someData) { out << "(" << …

Member Avatar for Hilariousity
0
2K
Member Avatar for mhaviv

I have a very simple program, a console application, that I wrote a long time ago under VS 2005 under XP. It worked perfectly OK. The program gets names and in the end prints them on the screen, until I do not enter a new name but only CR to …

Member Avatar for SeeTheLite
0
169
Member Avatar for moosoo

hi, where can i get all or most of the libraries for c++ and where do i place them?.....one more thing.....i have visual c++ how can i find out what libraries i already have...i dont see any library folder in the main folder....thanks

Member Avatar for SeeTheLite
0
67
Member Avatar for lehe

I perhaps have to resort to multiple thread programming to reduce computational time. I am now studying how to use POSIX library. I can access a cluster with 8 CPUs, each of which has one core. I was wondering how many threads to create would get approximately best time performance …

Member Avatar for mvmalderen
0
85
Member Avatar for drjay1627

just out of curiosity (definitely not because i have a deadline tonight lol) how does a plagiarism detecting software work? any ideas? i'm pretty sure the program compares run time... for example if i create an array in main [code] main(){ //create array and add numbers } [/code] then in …

Member Avatar for mvmalderen
0
99
Member Avatar for Scofield89

im working on the following program, #include <iostream.h> #include <math.h> void main() { float x,y,z; int s; bool b; cout<<"x"<<'\n'; cin>>x; cout<<"y"<<'\n'; cin>>y; cout<<"s"<<'\n'; cin>>s; if(x==y) z =0.9; else z=0.8; cout<<"z="<<z<<"\n"; b=s%100; cout<<"b="<<b<<'\n'; x=3; for(int i=1;i<=3;i++) { x*=2; cout<<" "<<i<<" "<<x<<'\n'; } } and it gives me 3 warnings: truncation …

0
12
Member Avatar for Cyken

Hey guys, i am very new to C++ but i know some little things about it. I am trying to make a simple dos program with simple arithmetic but i forgot how to do some things since it has been ages since i last coded. I am trying to make …

Member Avatar for Cyken
0
109
Member Avatar for tomtetlaw

i am making a list template for a tutorial, heres the code: [code=c++] template<typename t> class list { int sz; t elem; public: list() : sz(0), elem(new t[0]){ } list(int i) : sz(i), elem(new t[i]){ } list(int* i, double val) : sz(i), elem(new t[i]) { for(int i=0;i>sz;i++) elem[i] = val; …

Member Avatar for Intrade
0
105
Member Avatar for Carrots

Hi! I was hoping for some advice on how best to create a single doubly-linked list which could contain all of the different types of classes I have. This is the code I have written so far.... [B]shape.h:[/B] [code=C++] class Shape { public: Shape (int l=0, int h=0) : length(l), …

Member Avatar for Intrade
0
121
Member Avatar for devfolarin

i need help on some code im having trouble with its an x and o ai i havent finished the strategy function. im running a linux os and i need help with a segmentation fault also some help to make the code better would be appreciated //dtai-II //concept by temi …

Member Avatar for SeeTheLite
0
84
Member Avatar for longmatt

Hi guys, I am going mad. I am trying to code an algorithm in C++ and already at a very early stage there appears an error that I just don't understand... These are the error messages sent by the VC++ compiler: [code] \surface_watershed_matlab\surf_watershed.cpp(138) : error C2653: 'CMesh' : is not …

Member Avatar for longmatt
0
101
Member Avatar for Lukezzz

I use rand() to generate random numbers between 0-50. However when I use the code, as I have seen it, rand() doesn´t truly generate random numbers. It seems that everytime I restart the application, it generates the same random numbers everytime. It seems that there is any mathematical sequence the …

Member Avatar for DavidB
0
139
Member Avatar for theories

In all of the projects I've created in my college classes I've always declared the variables that will be used in multiple methods (passed by reference) in my main method and then passed as needed, allowing for the main method to be nothing more than a control for what variable …

Member Avatar for ArkM
0
83
Member Avatar for Lukezzz

If I have a backgroundWorker that has executed like this: [code] backgroundWorker2->RunWorkerAsync(); [/code] If I now want to cancel this, I have put this line of code at the very last line in the _DoWork event of the backgroundWorker2. I am not sure if that works or if it is …

Member Avatar for Lukezzz
0
134
Member Avatar for ItecKid

Hello, If I have code like such: [code=c++] map <string, map <string, int> > foo; map <string, map <string, int> >::iterator bar; [/code] How to access the value of the nested map? Normally I access a map's value like such: [code=c++] bar->second; [/code] To that end, I tried doing this …

Member Avatar for ItecKid
0
2K
Member Avatar for drjay1627

if we use queue from c++ stl, we don't need //void enqueue(struct queue *q, int a) //int dequeue(struct queue *q) functions? my TA has it on the slides but since the c++ queue has push and pop enqueue and dequeue isnt needed, right?

Member Avatar for drjay1627
0
65
Member Avatar for Nemoticchigga

Does anyone know how to delare a managed class in unmanaged code? This is driving me nuts, because I can call unmanaged from managed, but not the other way. Is there a way to do this? Thanks in advance. I want this for example: class foo { public: //other code …

Member Avatar for Ancient Dragon
0
91
Member Avatar for kunal123

hii all, im trying to connect remote sq server using in c++ using CDatabase class. im getting an sql error Connection Failed SQL State '01000' SQL Server Error 14: [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Invalid Instance()). SQL State '08001' Connection Failed SQL Server Error 14: [Microsoft][ODBC SQL Server Driver][DBNETLIB]Invalid connection the …

Member Avatar for MrSpigot
0
158
Member Avatar for rahul8590

i am working on image processing , which intially i used to do using MATLAB . but now i have been told to do using using JAVA or C++ programming ,. Since i know the fundamentals of C++ i guess i would be the right choice But the problem is …

Member Avatar for Nick Evan
0
233

The End.