49,761 Topics
| |
It goes "BLEEP" when one of these strings are input. [CODE]int main() { vector<string> words(); words[0] == "roller coasters"; words[1] == "waiting"; words[2] == "people who talk on the phone while driving"; words[3] == "wars"; string temp; while (cin >> temp) words.push_back(temp); for (int i = 0; i < words.size(); … | |
The following code snippet can be used to convert a decimal integer into any base from 2-16. This is a simple piece of code and I hope t proves useful to people. I see many people posting Decimal to Hex. or Decimal to binary, non any better than the next. … | |
[CODE=cpp]struct Table { char* aTag; char* bTag; }; int main() { Table T1; cout<<T1.aTag; cout<<T1.bTag; return 0; }[/CODE] This might be crazy but... i really need to know is there any way to so that we can only write [CODE=cpp]cout<<aTag cout<<bTag [/CODE]instead of [ICODE]T1.aTag[/ICODE] like we do in [ICODE]namespace [/ICODE] … | |
Hello again. Thanks to all that contributed positively to my first thread. it went a long way. Now, i am here again. can someone please help me out in the case of vectors.i.e. [#include<vector>]? Please do not be angry at me for posting such oversimple questions,i am a dumb beginner … | |
Hello! Well, I need an alternative to be able to delete files not accessed for more than 5 minutes. I already know how to do this using the system programs, but wanted something done in C++ once, to avoid bottlenecks. Is there any way to do this? (if not understand, … | |
Hello I work with g++ on ubuntu 9.04 Here is a code from cpp file: [code]for(subPipelineStrings::iterator pipelineIterator = pipelineRange.first; pipelineIterator != pipelineRange.second;++pipelineIterator) { pair<set<pipeline>::iterator,bool> uniqRes = uniqPipeline.insert(pipelineIterator->second); if(!uniqRes.second) { pipelineIterator = m_subPipelineStrings->erase(pipelineIterator); } } [/code] Here is a declaration .from h file [code]typedef multimap<size_t,pipeline> subPipelineStrings; [/code] I have following error … | |
I'm trying to learn C++ on my own so I figured I'd try to write a program for my data communications class. We were learning about hamming codes and I want to try to make a program that will let me do it automatically instead of on paper. I'd take … | |
I am trying to reference a 2d dynamic array which i used pointer to pointers to declare. the constructors run without a problem but as soon as i run another function or an overloaded operator i get errors. Its almost like i am referencing the array in the pointers incorrectly. … | |
Hey, So I am trying to get several numbers (below ) to be stored in various variables. Could you look at my code and tell me what I am messing up? (trying to emulate an example from class that I missed, stupid swine flu...)) the numbers (yes there is a … | |
I have a file that consists of dates like this: 12/[B]01/[/B]2008 12/[B]02[/B]/2008 12/[B]03[/B]/2008 12/[B]04[/B]/2008 12/[B]05[/B]/2008 Now if I will read this file from beginning to end, this is a solution: [code] String^ FilePath = "C:\\DateFile.txt"; String^ GetLine = ""; StreamReader^ Read = gcnew StreamReader(FilePath); while(Read->Peek() >= 0 ) { GetLine … | |
01 Why i am not able to do this [CODE]int* px; px = new int[2][2]; [/CODE] other the [ICODE]px = new int[2*2];[/ICODE] is there any other method 02 Why i am not able do access through pointer dx by [ICODE]dx[1][2][/ICODE] other than by using [ICODE]dx[1*7+2][/ICODE] [CODE=cpp] static float mat[5][7] = … | |
Hi, I'm trying to implement my own allocator using malloc and free. One thing what interests me is that in declaration of deallocate in addition to pointer we have also parameter size which suppose to be size of elements allocated with allocate but having implemented my deallocate as this: [code=c++] … | |
Hi, <--- Newbie I am trying to install the Boost libraries, specifically the Boost filesystem library. Many of the libraries are header-files only. No building. The Filesystem library requires me to build binaries... A new challenge, but I was able to pull it off. However, the binaries are located in … | |
Hi , I recently read this on another forum... [Quote] C/C++ are still standards for writing fast, standalone software, so you'll be wanting to work your way there. [/Quote] If I want to develop an application that has many "if statements" and many "loops" , that executes only on the … | |
Hello. I'm having a hard time finding which block of code in this program is [B]"insert in the middle"[/B] for Link List, so I can study it. Can someone point out where it is in the program and if insert head code below is included in insert middle. Much appreciate … | |
Hi All! I have a doubt about returning reference. I'll show you an example: [CODE] Vector &MakeVector() { Vector *result = new Vector<Dim>(); /*some more code*/ return *result; } [/CODE] now I can call the function MakeVector to assign it result in this two ways: [CODE] Vector v = MakeVector(); … | |
can u please send me a code for implementing a singly linked structure with the class Animal, by defining the ff methods and overloading those necessary opreator*, operator++, operator--;operator++(int), operator!=,push_front,pop_front.tanx | |
Hi,I want to convert String^ to Int array or a char array.I am reading numbers from a file in GUI but the StreamReader Reads the Text in a String.I need to convert them to use the numbers. I have tried ToCharArray() function but it doesnt work! this function gives the … | |
Anyone could help this? I am using a MSVC++ compiler.. Thanks a lot.. | |
can s/o plz give a simple example of how recursion can be used in programming....im new to this topic so i need help i cant develop new codes myself. | |
This program kinda works, but I have one problem. I setup this program to display a message when someone enters a negative number, but I how do I set the count back to zero. Even though mesage prompts the user that a negative number is invalid, it still calculates the … | |
[CODE] #include <iostream> #include <conio.h> using namespace std; struct employeeInfo { string name; int id; string department; employeeInfo *next; }; class List { public: List(void) { head = NULL; } // constructor ~List(void); // destructor bool IsEmpty() { return head == NULL; } employeeInfo* InsertEmployee(string ,int ,string ); void DisplayList(void); … | |
Hi. I'm trying to use SetBkColor to change the background color of my control. In XP I can see the result, but in Vista no affect, the default backgound color it taken. Any ideas? Thanks. | |
I have the following code snippet which is the most important as you can see I have two arrays defined of two different classes, my main agenda is printing them both out in a single list in ascending order based on the .GetDay value in each array, however when read … | |
I wrote the below code and when I try to compile it I get the following error: error C2109: subscript requires array or pointer type. Can anyone tell me what I did wrong and how I can fix it? Thanks a lot! :) [CODE] // This program writes the bombsweeper … | |
this is a c++ program for the simulation of gillians island i did. im a newbie in programming looking to improve on my skills. Can some assist me on how to break this code into functions. please dont rewrite the code i need just a sampler from code i can … | |
Alright, so the assignment which im sure you guys have seen around alot is to do a powerball type program, 1-55 for the first 5 numbers then the 6th 1-42. I set up the program, i get my random numbers. but the teacher wants you to assign a single variable … | |
Thanks to the help I recieved earlier, I figured out how to make my other header file and my other .cpp file!! So thank you for that. I am now trying to compile all of my files together, and am getting quite a few linker errors, even though the functions … | |
Wow sorry for so many edits I just need to swap the rest of my array of structs along with the day value now delete this post or post insight on how [code] int x, y; for(x = 0; x < l; x++) { for(y = 0; y < x; … |
The End.