49,761 Topics
| |
Hi, Im trying to compare an inputted string to an array of string. If the inputted matches one of the array of string it should return 0, but if not it should return 1. Any suggestion on how to do this? This is my program: [CODE]{ for ( int j=0; … | |
I would like to take a diploma in c++ programing. Anyone could help me find the best online university ? Thanks | |
I'm a beginner programmer and I'm trying to make a add function that adds two numbers. but these numbers are passed by strings. ex. four + five = is 9. if the answer goes over 10m then it prints out "error". can anyone help me ?? [ICODE] int add (string … | |
Im trying to make a program that has a base class Account and a class ,Savings , that inherits from it. however i keep getting an error that says expected class name before { token and it shows it where i wrote [CODE]class Savings : public account { [/CODE] there … | |
All things equal, does an object of a class which has methods take up more memory resources than an instance of a class without methods. What if it is a vector of such objects? For example: [CODE] class A{ public: void DoSomething(); void DoSomethingelse(); private: int x, y; }; class … | |
This program keeps track of a hardware store inventory. It's very barebones, all it needs to do is put the information into a vector of pointers to a struct, allow the user to sell items, and print the report. I have printing down no problem, but selling is where I … | |
Hi, i have some issues with class inheritance and i do not know how to solve it, maybe someone could help me with that ? [CODE] //pentathlete.h #include <iostream> using namespace std; template < class T > class pentathlete { protected : T comp_res [ 5 ] ; /*private: int … | |
In my function, I am using .find and I need to be using .at, because the way I have it now doesn't account for extra whitespace etc., but I have no idea how to implement this change. I looked through the internet and I can't find a good example of … | |
I am supposed to read in data from a file and store it. I know how to read from a file and display it, in main, what i don't understand is how to do that with classes and objects. This is the part im having a little trouble with and … | |
Hello, i need a simple C/C++ program that sends SMSs via the attached GSM modem. I have some experience in C programming, but i haven't controlled the COM port. Also, i need to give 2 variables , one for the recipient's number, and second for the actual message. So, when … | |
So, I've bought two books, one on DirectX 10 and one on OpenGL. The first one i bought was the directX 10 book, and NONE of the code compiled because of some LPCSTR error. So stupid me thinking it was another thing that microsoft goofed on i bought a book … | |
Hey. My program wont write the input data to file. It seems like the userdata variabels doesnt get updated after input from the user. Can anyone see what i have done wrong? This is what i have done so far: [CODE] // userdata.cpp // class userdata store user information #include … | |
Hey, let me try explaining what i need to do with an example Example Before sorting arr1 = {15,12,18,11} arr2 = {1,2,3,4} arr2 is always in ascending order and its length is based on the number of elements in arr1 After sorting arr2 = {2,3,1,4} So basically i need arr2 … | |
Hi, I was implementing the Exampler / Prototype pattern just to brush up on C++. Couldn't figure out how to do the cleanup at the end. Problem is deleting all the prototypes from the map in base class at the end. I.e. deleting all stored pointers in [ICODE]Animal::examplesPtr[/ICODE], which is … | |
[CODE]#ifdef _WIN32 #include <windows.h> #endif #include <iostream> #include <vector> #include <string> #include <SDL/SDL.h> #include <GL/gl.h> #include <GL/glu.h> using std::vector; void error(const std::string& s) { #ifdef _WIN32 MessageBox(NULL, s.c_str(), "An error occurred", MB_ICONINFORMATION | MB_OK); #else std::cerr << s << std::endl; #endif } [/CODE] That's my problem... [CODE]1>------ Build started: Project: … | |
Ok, I've been trying to run this program on Borland C++ (Version 5.0A). The program is a Point of Sale program. I keep getting the errors "expression syntax at (121,26)" and "If statement missing ) at (129,6). Try as I might, I can't seem to fix the errors. Help? [CODE] … | |
Hi guys: I created this program that will read into two files and compare a number from one file into the other and if they match, it will print out some information. I ave two if statements and it seems that the second one can't be read. I tried putting … | |
I ma brand new to templates and I have been given an exercise to reverse the elements using vectors which I did perfectly. But I need to include the template thing which I tried my level best to understand and do but still I am getting many errors. Any help … | |
What is the difference between a stand-alone and a member-function operator? | |
first my task was to write this program that checks that string t contained in string s or not and i successfully made it and now i have to change this program a little bit and now i have to use a bool function in this program any one can … | |
I am finishing up this program and need to find the GCD using euclids formula. I am attaching my code and was seeing if anyone could show me what is wrong. I am also sending the instructions just in case you need it... [code] //Programmed by: Bryan Kruep //Date: 2/22/2010 … | |
i keep getting this error in my main.cpp [code]main.cpp:17: undefined reference to `Game::Game()'[/code] this is the code i have pertaining to the error [code] #include "Game.h" #include<iostream> #include<cstring> #include<iomanip> #include<cctype> #include<fstream> #include<string> int main() { ifstream din; Game output; output.fillGame(din); return 0; } [/code] i doubt it but just in … | |
[code] class A { virtual void func()=0; }; class B : public A { void func (); }; class C : virtual public B { void func(); }; //I receive an A* pointer through a function in an LPARAM type argument //and i must downcast from an A* to a … | |
I need to take an input file that contains name listed like: John Henry Mary Baker and create an output that looks like: Baker, Mary. Henry, John. Right now my output is just ,. ,. ,. ,. ,. ,. I can't use any global accesses, or a character processing alogorithm. … | |
Hi All, I want to register the .dll files in my setup project. I am creating the Setup project for installing it on 64 bit Windows 7 machine, And I have successfully installed on 64 bit Machine. The issue is, while running the application installed on the 64 bit machine, … | |
Hi, I am working on this code: [CODE]#include <iostream> using namespace std; send(to, from, count) { register int *to, *from; register int count; { register n=(count+7)/8; switch(count%8){ case 0: do{ *to++ = *from++; case 7: *to++ = *from++; case 6: *to++ = *from++; case 5: *to++ = *from++; case 4: … | |
Im trying to read from a file using classes and objects. i keep getting this error [CODE]main.cpp:16: error: no matching function for call to ‘Game::fillGame()’ Game.h:41: note: candidates are: bool Game::fillGame(std::ifstream&)[/CODE] here is code that goes with the error [CODE] //Game.h bool fillGame(ifstream & din); [/CODE] [CODE] //Game.cpp #include<iostream> #include … | |
[CODE] #include <iostream> #include <vector> #include <algorithm> using namespace std; class A { public : void getData(vector< A > &); void putData(vector< A > &); private : int x; char name[90]; }; vector< A > v; void A :: getData(vector< A > &Aref) { cout << "id = "; cin … | |
Hi, I'm a beginner programmer and I have an assignement of making the radix sort! My plan is to make a helper function that will return the place value of a number. (for example, if the number is 127, then the function will return either a 1, 2 or 7) … | |
Hey guys! I'm trying to write a program that involves a switch/case on Microsoft Visual Studion 2010. Unfortunately, some of my variables are not being initialized. I am a very novie programmer so please have mercy on me! Two of my options (1,4) are working but options (2,3) are not. … |
The End.