49,762 Topics

Member Avatar for
Member Avatar for dreday92

My program wont compile because of this one function, can someone explain to me why it is says "forbids comparison between pointer and integer" Any help would be appreciated void ReadBitPattern (ifstream& infile) { int x; x = cin.get(); if(cin.get() == "0") { for (int index = 0; index < …

Member Avatar for NathanOliver
0
102
Member Avatar for steveincolorado

Hi I am trying to write a small C++ program using nested loops so that when the program executes I have the following output displayed [code]** **** ****** ******** ********** ************[/code] Here is the code I have written. I seem to be having a problem with proper loop execution. I …

Member Avatar for maaz0088
0
394
Member Avatar for nyquist

Hi, i need to create a binary matrix (one which elements can only be 1 or 0) in openCV. The nearest that I was getting is creating a matrix which elements are 8-bit values using the CV_8UC1 dataType. There must be another dataType which specifies that the matrix elements are …

Member Avatar for vijayan121
0
6K
Member Avatar for clarkkent021

hi, I installed both codeblocks ans codelite as suggested but these two IDEs are much different from the simple turbo c and I am having some similar problems using the two.:- during the first session i created a workspace and a new project(a console application) a main.c was created by …

Member Avatar for vijayan121
0
269
Member Avatar for tspga

i have tried hard but dont know wy im getting this error , error comes in line 8 class CPop { CBSVector<CTour> pop; CBSVector<double> probability; int popsize; double TotalFitness; CTour Elite; **CTspGAParams GAParameters;** } error C2059: syntax error : 'constant' error C2238: unexpected token(s) preceding ';' [POP]// Pop.h: interface for …

Member Avatar for tspga
0
164
Member Avatar for chris.vargas.773

i wrote this program it c++ in response to this question "total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk (which will need to be a value rounded up to the nearest integer), the cost of producing the milk …

Member Avatar for Bob
0
311
Member Avatar for rekhamanoj
Member Avatar for tvm78

Alright, so I am designing a program that contains binary trees to function as a parser. I have encounted a very strange problem that is causing my program to fail while it is running. I have done several tests and narrowed down the incidents. Ok, so this results in a …

Member Avatar for mike_2000_17
0
355
Member Avatar for Vasthor
Member Avatar for mike_2000_17
0
156
Member Avatar for Dev93

I tried to run the basic code to create and open a window . The code is as follows : #include <iostream> #include <SFML/Window.hpp> int main() { // Create the main window sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window"); // Start main loop bool Running = true; while (Running) { App.Display(); …

Member Avatar for Dev93
0
384
Member Avatar for dreday92

I was wondering why the compiler keeps telling me #include <iostream> #include <fstream> #include <iomanip> #include <cstdlib> #include <string> using namespace std; const int PatternSize = 8; typedef int OperandArray[PatternSize]; // the major data structure, the BitPattern class class BitPattern { public: // default constructor, sets all bits to zero …

Member Avatar for sfuo
0
106
Member Avatar for poloblue

Good Morning, I'm a little difficulty in writing and implementing a function that read a list of words of variable lengths and convert all letters to upper case. Ask the user to enter the size of the list. I shall use an array as pointers. So far, I have this, …

Member Avatar for WaltP
0
206
Member Avatar for madhusudan.srinivasan

#include<iostream.h> #include<conio.h> #include<string.h> int main() { clrscr(); char string1[20],string2[15]; int i,j; string1="AMITABH BACHCHAN"; string2="RAJNIKANTH"; int n1=strlen(string1); int n2=strlen(string2); cout<<"common alphabets in AMITABH BACHCHAN AND RAJNIKANTH are-"; for(i=0;i<n1;i++) { for(j=0;j<n2;j++) { if(string1[i]==string2[j]) cout<<string[i]; } } }

Member Avatar for ravenous
0
241
Member Avatar for zvjezdan.veselinovic

I am trying to make a program where when I click an arrow key, the object moves constantly until I click another arrow key; or, when my object reaches a wall and crashes. For my code, I have made arrow key movements, I have assigned them in the program, and …

Member Avatar for zvjezdan.veselinovic
0
173
Member Avatar for theguitarist

Hi. I have some trouble understanding the linking process and hence this related question. Lets say I need a global variable that is needed by every single source file in my project. I would create a `constants.h` header and put `extern const int var;` in it. In corresponding source, `constants.cpp`, …

Member Avatar for mike_2000_17
0
6K
Member Avatar for ConfusedLearner

Keep saying The variable 'width' is being used without being initialized. #include <iostream> #include <cmath> using namespace std; int main() { float length; float width; float area; cout << "Enter The Length Of The Rectangle: "; cin >> length; area=length*width; cout <<"The area of the rectangle is : "<< area …

Member Avatar for np complete
0
181
Member Avatar for venomxxl

Hello I'm not new to C++ programming, but I have a question for you guys and gals :) So the code below compiles fine (due to that ugly workaround in main func), but that makes d_copy.field2 unitialized (0xCC bytes in MSVC). How would you change the code to make d …

Member Avatar for venomxxl
0
117
Member Avatar for IanKent

So, we are making a card game for class using a deck of cards valued 1 to 52, using lists and stacks. It deals each player a card, compares the value, then awards a point to the winner and restarts. I am using stacks to keep track of points, and …

Member Avatar for deceptikon
0
118
Member Avatar for Dersev

Hi I have a question about memory address on Windows Mobile 5.0 I found application pid by task manager which I downloaded from internet. Is it possible to find memory addresses by pid on Windows Mobile ? I know that VisualC++ has built in methods but for desktop Windows. I …

0
132
Member Avatar for mferarri

Hi all, I am learning to code in c++ on Linux Mint 13. I am going through an exercise drill in a book called "Programming Principles and Practice using c++ by Bjarne Strustrup". I have a couple of questions. - I am having trouble with the calling the error function …

Member Avatar for mferarri
0
172
Member Avatar for VernonDozier

Someone a few months ago told me that I had to change a bunch of code from stuff like this... // config_options.h // define _FOO if and only if you want option foo to be available #ifndef _FOO #define _FOO #endif // main.cpp #include "config_options.h" #ifdef _FOO void foo() { …

Member Avatar for VernonDozier
0
782
Member Avatar for triumphost

What am I doing wrong? In the following templated functions, I'm trying to convert all my CopyMemory functions to std::copy functions. I'm not sure what I'm doing wrong as they don't work as they should with the std::copy but instead, they work with memcpy and CopyMemory. I'm only doing it …

Member Avatar for vijayan121
0
557
Member Avatar for mke48

I'm having problems with the code below. I figured since Monster1=new Orc 's attack function can't know whether it's attacking a Troll or Goblin since it accepts an Entity pointer as an argument. But having the be_attacked functions doesn't help either #include<iostream> using namespace std; class Entity { public: virtual …

Member Avatar for vijayan121
0
145
Member Avatar for harris24

Hi, I've posted m code below and cant get it to work because of *fatal error c1004 unexpected end-of-file found*. Appreciate any help. #include <iostream> using namespace std; /* //what i addedint q[8][8]; void printSolution();//int q[]); void hereQueen(int q[], int n1, int n2); */ class Queens { bool canGo; int …

Member Avatar for harris24
0
513
Member Avatar for np complete
Member Avatar for WaltP
0
276
Member Avatar for triumphost

Why is C++ on linux basically C? I've tried everything to avoid C on linux but it's simply near impossible. I've tried to stick directly to the standard library but I somehow find myself using dirent.h, types.h, etc.. Is there any other ways to do these other than using C …

Member Avatar for deceptikon
0
759
Member Avatar for Dev93

I have just started getting into SFML and Visual studio as well . I have always worked on turbo c++ . I am not sure I understand the very first code that I have come across while getting into SFML . Here is the program.. #include<iostream> #include<SFML\System.hpp> int main() { …

Member Avatar for Bob
0
390
Member Avatar for Dev93

What should be the output to the following code ? I am confused because I am getting a slightly different output everytime . Any other advise would also be appreciated . #include<iostream> #include<SFML\System.hpp> void apple_thread(void *data) { using namespace std; for(int i = 5 ; i<11 ; i++) { cout<<"I …

Member Avatar for Ancient Dragon
0
332
Member Avatar for mke48

I'm having a problem with the code below. Can anyone help me? #include <iostream> #include <string> using namespace std; class Aircraft { public: Aircraft() : MPrice(0), LPrice(0), BPrice(0), PPrice(0), TotalPrice(0) , Stars(0) {cout<<"aircraft constructor"<<endl;} virtual ~Aircraft(){cout<<"aircraft destructor"<<endl;} protected: string Missile; string Laser; string Bomb; string Propulsion; int MPrice, LPrice, BPrice, …

Member Avatar for jacob.lemelincarrier
0
3K
Member Avatar for firdousahmad

The End.