49,757 Topics
| |
Hi, I used to have difficulty with more advanced bits of scope but eventually understood but after a long break from c++ i have of course forgotten bits. my problem is with this bit of code: [CODE]std::vector<int>::iterator it[/CODE] as i understand it this bit of code creates an iterator for … | |
I just saw someone's program that assigned string this way: [CODE]string x("snow");[/CODE] It seems to work, as I could display the output x as "snow". Is this a legible way to assign strings? How does it differ from [CODE]string x="snow";[/CODE] ? | |
In a question i am required to add every other number starting from the right most side and going left on every other number. I have a code that is almost right as i am led to beleive. the code is: [CODE]#include <iostream> #include <cmath> int main () { int … | |
Hello People, I just came across this code as I was browsing through some C++ problem sets. This code gives compile time error but I am unable to understand the reason. I am C guy and my knowledge about C++ is not that great. So pardon if there is an … | |
Hello people, I have two classes everyone with private data. I want only one function from each class to access private data from another class. I have checked "friend" function but It needs the class object as an argument. That is making things complicated on my side and I have … | |
I want to call the input function, which works when I run it, but then I want to display the "temp" and "windspeed" variables in the main function and I don't know how to do this, im looking online at tutorials but im still confused. I guess I shouldn't have … | |
Hi I am trying to answer this question for my homework: [QUOTE] Populate a text file EmployeeDetails.txt (for 20 employees) with details of each employee on a single line. Details of an employee will consist of Name, Address, Age and Salary. Write a C++ or Java program to implement an … | |
okay so im new to programming and have an assignment im not sure how to do the question is. The original U.S. income tax of 1913 was quite simple. The tax was [INDENT]1 percent on the first $50 000[/INDENT] [INDENT]2 percent on the amount over $50 000 up to $ … | |
This is a program that is meant to be a dice game with the computer, and this is what I have so far. I'm trying to make sure that I'm doing it right but I can't compile it to check because of a syntax error near the end of the … | |
hello , Im creating a top down game. Id like to know what is the formula for moving X and Y values N pixels in a specified direction (0-360) ? [CODE] int x=0; int y=0; int speed=3; // "n" int direction=45; //some formula ... //output x=3; y=3; [/CODE] | |
Program not running I'm not sure of he problem [code]//Employee.h #ifndef CLASS_H #define CLASS_H class Employee { protected : char *firstName; char *lastName; public: Employee (); Employee ( char, char ); //accessors //retrieve const char *setfirstName (char); const char *setlastName (char); //mutators //return const char *getfirstName (char); const char *getlastName … | |
Hi, I wish to create a very simple GUI for my C++ code I have written a simple C++ program using Microsoft Visual C++ Express. The details of the program functionality are not really important. Currently the user enters a number (1-5) on the command line and presses enter. A … | |
Sorry guys, I know it is not C++ specific, but Wikipedia confused me. I have devoted a little time to look at programing tools and little on their innner workings. This term have boggled my mind. So any explanation on what this animal is? Thanks | |
Hello, I just start to learn c++. what I'm using is visual c++ express edition. here is the source code: --------------------------------------start [CODE]#include <iostream> using namespace std; template <class T> class pair { T value1, value2; public: pair (T first, T second) { value1=first; value2=second; } T getmax (); }; template … | |
// error: expected constructor, destructor, or type conversion before '*' token *** Error code 1 make: Fatal error: Command failed for target `bst.o' [CODE] class BinarySearchTree { private: int count; int n; struct tree_node { tree_node* left; tree_node* right; char data[1000]; }; tree_node* root; public: BinarySearchTree() { root = NULL; … | |
Hello I have been trying to make a function that can send the output data or any text to a network printer, I read many articles/posts about it but nothing is working, have been looking for almost a week... Whenever the program tries to use the printer function, it either … | |
This is the operator overloading for the polynomials doubly linked list , this code is working fi9 but i m getting repetition like 1x^1 2x^2 when added with 1x^1 3x^6 2x^1 2x^2 3x^6 but i get those terms also which are subtracted already like i get 1x^1 2x^2 1x^1 3x^6 … | |
Good day. I am attempting to write a C++ Program than must open a text file with random caharacters and then convert these characters into readble text. It must also be able to do the reverse Example like: If the text file has "%&^#)@!#@" It should convert that into "Hello … | |
How to create simplest IME-aware application? I’m a beginner and don’t know anything about IME-aware applications, please, give me complete code of a simplest IME-aware application. Thanks in advance. | |
I am designing a artificial life simulator atm and it would be very useful if I could pass any statement as an argument. For Example. [CODE]LoopStatement(X += 2,50)//loop statement 50 times //or LoopStatement(X += 2 * Speed,75)//loop statement 75 times[/CODE] I know the for loop has something like that. Also … | |
I have a program that a friend wrote for me in Java, however I'm trying to put it in C++ and I don't know Java myself. Does anyone know somewhere that I can get it translated? Or maybe someone who has time to translate it themselves? It all looks vaguely … | |
[code] #ifndef BASE_H #define BASE_H class base { public: base(); struct baseInfo { int SlotCount[4]; }; private: protected: }; base::base() { } #endif [/code] This is my header file, but how do I access the struct and its members through an object of the base class(through main)? I cant find … | |
Hi All, I am working on adding additional functionality to an existing legacy code. In that code, I have a function which returns a pointer to an object of a parent class. I know that this object is actually a subclass of the parent class, and would like to access … | |
Hello everyone. Home help = homework help :) can't change it now I'm running into an error, expected initialize before "int menu()" I have been playing around with it for a bit but I have not figured out how to get rid of the error. When I think I got … | |
hi! can u help on my 8 x 8 c++ project??., For example, suppose the cards are in the following layout: 1 2 3 4 5 6 7 8 --------------------------- 1 | 8 * * * * * * * 2 | * * * * * * * * … | |
any help would b greatly appreciated for the following how do i modify this to output the date in multiple formats: a)DDD YYYY MM/DD/YY June 14, 1992 b) use overloaded constructors to create Date objects initialized with dates of the formats in part (a). c) create a date constructor that … | |
So I am trying to take my assignment and make it load an input file instead of having to input each value manually. How would I do that? Also if my program took arguments (p1a, inputfile, outputfile) how would I link that too Thanks | |
//when I delete root node from bst the below code is showing segmentation fault,Please tell where should I change the code [CODE] void BinarySearchTree::remove(char* d) { //Locate the element bool found = false; if(isEmpty()) { cout<<" This Tree is empty! "<<endl; return; } tree_node* curr; tree_node* parent; curr = root; … | |
I am working on my first scrolling game. I am pretty new to game programming in general, but have so far successfully made a couple very simple games. (Pong, etc.) I am using Dev-C++ and the Allegro library for this game. It's basically going to be a cat that runs … | |
Can someone please suggest me a psuedo code to extract sub problems from an arithmetic expression: For example, How do I remove (8*2) and (3+2) from a given string (5 + 6(3+2) - 2(8*2) +1) Input string will always start and end with paranthesis and the sub problems must be extracted … |
The End.