49,762 Topics
![]() | |
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 < … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
kindly let me know how to open an excel file in c++ | |
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 … | |
[Pictures](http://postimage.org/image/qnqrsvenn/) the picture explain it all. | |
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(); … | |
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 … | |
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, … | |
#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]; } } } | |
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 … | |
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`, … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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() { … | |
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 … | |
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 … | |
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 … | |
How am I supposed to take input/catch CTRL+C or CTRL+V commands ? | |
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 … | |
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() { … | |
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 … | |
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, … | |
What is the difference between Class and structure |
The End.