49,761 Topics
| |
[CODE]#include <iostream> using namespace std; int main() { int intArrayList[] = {4, 6, 2, 10, 9}; cout << "Unsorted list : "; for(int i = 0; i < sizeof(intArrayList)/sizeof(int); i++) { cout << intArrayList[i] << " "; } [COLOR="red"]intArrayList[/COLOR] = InsertionSort(intArrayList); for(int i = 0; i < sizeof(intArrayList)/sizeof(int); i++) { … | |
Hi all, I've spent the last week trying to sort this out, and the more I delve into it, the more confused I'm getting. I've done some background research (searched on google and here for sort function issues) and really I can't make head or tail of what's going on. … | |
Hey guys, Im making an uno card game and I think so far so good, however once I compile it, my program doesnt read any errors, but a box pops up stating "vector subscript out of range" and it is confusing me a lot. I think I can identify where … | |
why does this program have an exception in VC++ 2008 Express? [CODE] #include <conio.h> //#include <C:\WString(v2.00).h> #include <iostream> #include <string> using namespace std; class WCS { public: wchar_t* string; WCS(const wstring& wstr) { wchar_t* c = new wchar_t [wstr.size() + 1]; wcscpy(c,wstr.c_str()); string = c; } ~WCS() { delete [] … | |
My program keeps crashing and I can't see why...pretty sure its something to do with creating matrix B since when I remove the commands to create matrix B it runs ok. Can anyone see what is wrong? Thanks in advance! I have the header file: [code=php] // matrixlib.h - A … | |
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 | * * * * * * * * … |
The End.