49,761 Topics
| |
Ok, working on a program to find the shortest path between two points. Simple. Now, we are going to be given a list like this to denote the start and end, and then the weight of the lines. [code]A D B C 31 B A 4 C A 12 C … | |
How do I disable and Enable Menu Items and Sub Items. [code]if(Selected == "drum" || Selected == "guitar" || Selected == "mic" || Selected == "computer" || Selected == "car" || Selected == "hockey" || Selected == "laptop" || Selected == "watch" ) { pCmdUI->Enable(Sort == 1); }[/code] The above … | |
I encode a text file using a huffman tree. Which print out to the screen and and output to a file. File only contains the last line that prints to the console. [code]void traverse(string code = "") const { string outputFile = "huffman.txt"; ofstream outfile(outputFile.c_str()); if (child0 !=NULL) { static_cast<huffman_item<dtype> … | |
Hi to all! I never used Pointer Functions, and now i'm trying to use a C Pointer Function in Visual Studio 2005. But there's a problem... the pointer function isn't working properly... This kind of functions doesn't work in the same way in C and in C++? My pointer function … | |
hi everyone.. i have a small problem with the below code.. when i execute the program, the output file doesnt print me the unsortedList.ReturnLastItem().Print(); it gives me the following output: the last item in the unsortedList is how can i make it print me the last item? here is the … | |
I want to do something like this: unsigned char r[3] = {255, 0, 0}; map<unsigned char[3], int> ColorList; ColorList[r] = 1; But I get the following: error: array used as initializer How else would I set the r element of the map? Thanks, Dave | |
Hi there, been having some trouble with a simple program i am trying to write. I'm fairly new to C++, and can't seem to fix the errors im getting. Any ideas or hints would be much appreciated. [code=c++]#include <iostream> using namespace std; int main() { double payrate; double hours; double … | |
Hi all, I havnt explored BOOST yet. But I heard that it has support for almost every OS. I need to ask the experienced developers here that whether BOOST C++ library has support for IBM AIX, IBM MVS and OpenVMS. plz do reply as ur reply is always helpful to … | |
i have a few days to design a system(payroll) using C++. does anyone have the source code thank you | |
[CODE]// file: hangman.cpp // name: Kyle Burmark // professor: M. Gelotte // date: 2/26/02 // Description: This is a computer version of the game hangman, the user // can play against a 2nd player or the computer, and he can enter how many // guesses he gets, // // Start … | |
#include<fstream.h> #include<iomanip.h> #include<conio.h> #include<iostream.h> #include<stdlib.h> #include<string.h> #include<time.h> #include<iomanip.h> //-----------------------------------------------------------------\par \par \par class inventory\par \{\par \tab char name[25];\par \tab int code,copy;\par \tab float cost;\par \tab char stock[3];\par \tab char datestr[9];\par \tab char timestr[9];\par \par \tab public:\par \tab\tab void rdata(void);\par \tab\tab void wdata(void);\par \tab\tab void menu(void);\par \tab\tab void display(void);\par \tab\tab void mainpage(void);\par … | |
I have used a binary search tree to read in a text file, storing each word as a node, and counting how many times that word is repeated in the text file. I have been able to successfully [I]cout[/I] that information, but for some reason have been unable to read … | |
hello, i have been writing a program to sort names from one file and numbers from another file. i have the files being read in. each contains 1500 names or numbers. i have to sort the names alphabetically and the numbers have to move with the name it corresponds to. … | |
i wrote some code which only works with objects with a heading of 0 degrees right now because its not finished but when i run it it never seems to catch the collision and break the loop. I need some help, thanks in advance. [code=cplusplus] #include <iostream> #include <math.h> using … | |
void EnterWord() { char solution[20]; //holds solution char blank[20]; //holds "*"'s for unsolved letters int Subscript=0; int State=1; char Guess[20]; char Copy [20]; char Letter; int Correct =0 ; // input the string and getline it cout<<"Enter phrase 20 chars or less."<<endl; cin.getline(solution, 20); int Word; // this will hold … | |
I'm having a hard time with my code, can someone show me a fix? Here is my errors. 1>c:\documents and settings\chuckie taylor\my documents\c++ assignments\assignment 6\assignment 6.cpp\assignment 6.cpp\assignment 6.cpp.cpp(57) : error C2064: term does not evaluate to a function taking 2 arguments 1>c:\documents and settings\chuckie taylor\my documents\c++ assignments\assignment 6\assignment 6.cpp\assignment 6.cpp\assignment … | |
Hey, I'm new to this forum. I'm having trouble making a mapping/navigation type program. Kind of like one where you type in "N" and you go north. But more complex, scince i'm creating an rpg. (In command prompt console) I need to have the map visible. I would need to … | |
I am receiving the following compile errors: [CODE] BinarySearchTree.cpp:3: error: expected constructor, destructor, or type conversion before â<â token BinarySearchTree.cpp:9: error: expected initializer before â<â token BinarySearchTree.cpp:15: error: expected initializer before â<â token BinarySearchTree.cpp:21: error: expected initializer before â<â token [/CODE] Looking at my implementation, I fail to see the … | |
Hey i am new to this forum. I am also new to C++. I really need help with this program because i cant get it to work! Since its my first time posting, if I am posting in the wrong way please tell me. My program holds phone numbers. uhm … | |
[CODE]#include <iostream> #include <fstream> #include <string> #include <cctype> using namespace std; #define MAX_WORD_SIZE 15 // The maximum size of word #define MAX_WORDS 255 // the max number of words void EnterWord(); void LoadFile(); void ChooseWord(); void RunGame(); void instruction(); void DrawGallows(int State); typedef char String [MAX_WORD_SIZE]; // a char type … | |
Hey people, i am having the next easy problem but i dont find any answer on how to do that: Im using libxml2 to read a XML file, in one part of my code i need to compare two attributes from different nodes which are numbers (1,2,3,4,5,6...). The problem is … | |
Can some one help me with this error: =========================================error================================ In file included from /usr/include/sys/signal.h:34, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/pthread.h:22, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/sparc-sun-solaris2.6/bits/gthr-default.h:37, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/sparc-sun-solaris2.6/bits/gthr.h:98, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/sparc-sun-solaris2.6/bits/c++io.h:37, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/bits/fpos.h:44, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/iosfwd:46, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/ios:44, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/ostream:45, from /util/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.2.2/include/c++/iostream:45, from main.cpp:1: /usr/include/sys/siginfo.h:259: 'ctid_t' is used as a type, but is not defined as a type. /usr/include/sys/siginfo.h:260: 'zoneid_t' … | |
can someone help mi out with how to write a simple(2X2) matrix....I need help only with the loop used..... I got a wrong answer with what i got below [code=cplusplus] const int Row = 2; const int Col = 2; int main() { int MatrixA[Row][Col] = {1,2,3,2}; int MatrixB[Row][Col] = … | |
Consider this working code: [icode] #include <iostream> using namespace std; class Base { public: void print(string val) { cout<<val<<endl; } virtual void print(int val) { char temp[1000]; sprintf( temp, "%d", val ); string tempstring = temp; print ( tempstring ); } }; int main() { Base a; string whatever= "BLAH"; … | |
I would like to make a list of colors with an associated color index ie 1, [1 0 0] 2, [0 1 0] 3, [.4 .4 .4] etc So I could make a map map <int, double*> ColorMap; Then I could look up the color by its index like this: … | |
Can someone take a look at my code, I'm having errors with the end loop. [CODE]#include "stdafx.h" #include <iostream> using namespace std; int area (int, int); // function prototype int volume (int, int, int); // function prototype int _tmain(int argc, _TCHAR* argv[]) { int length, width, depth; // parameters for … | |
[CODE]#include <iostream> using namespace std; #include <string> #include <cctype> void DrawGallows(int ); int main() { char solution[20]; //holds solution char blank[20]; //holds "*"'s for unsolved letters int counter = 0; //general-use counter int right = 0; //1 = right guess, 0 = wrong guess. char guess; cout<<"Enter phrase 20 chars … | |
helooo am new to C++ hope i will find some help here :) well the question is if the i ask the user to input an integer like int a; cin>>a; and if user inputs 2345 and the output i require is 2 3 4 5 how will i do … | |
i am done with the main of the program but i have difficulty with several functions that need help if u please help me thank u very much #include <iostream> #include <string> using namespace std; void Output(struct Employee *data_ptr); void Input(struct Employee *data_ptr);void AddElement_Front(struct Employee E); void AddElement_End(struct Employee E); … | |
Hi all. I want to learn how to manipulate .txt files through C++ program. I want to be able to search trough chars in .txt file,sort them etc. I think the best way for this,should be,loading .txt file in char array and then manipulating the elements. but I don't know … |
The End.