51,593 Topics
![]() | |
Hello, and thank you for taking the time to help me out! I am working on my first real C++ program, and have the code almost entirely written. The assignment is to write four files, CPU.h, CPU.cpp, Computer.h, and Computer.cpp, which maintain information about an object (a computer), and then … | |
Hi, I am currently having problems in my upperCase function. For 20 words out of 50 in my input file, I want to capitalize the first letter. Can someone please help me with this and lead me to the right direction. I have been trying for hours to figure it … | |
Hello. I need some help with my program wich shoulc calculate letters in a sentence and then print out the longest, shortest, how many words, and what's the avrage value. Thanks for some help. :) [CODE]#include <iostream> #include <string> using namespace std; int main() { int word; int n; string … | |
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; … | |
Hey, im looking for a good C++ IDE on Linux. Wanted features: Integrated debugger support Code formatting Syntax highlighting etc.. I hate code folding and that auto-bracket thing Preferably one thats fast. I tried Eclipse CDT but it crashed all the time and i didn't like it. I get on … | |
c:\documents and settings\administrator.rahulabbine44fd\desktop\cs340 proj1\cs340 proj1\binarytree.cpp(27) : error C2143: syntax error : missing ';' before 'BinaryTree<E>::getNode' in cpp file template <class E> nodePtr BinaryTree<E>::getNode(E item){ nodePtr<E> temp = new nodePtr; temp->data = item; return nodePtr; } in headr file: struct node; typedef node *nodePtr; struct node { E data; nodePtr left; … | |
[CODE] #include <iostream> #include <windows.h> using namespace std; HHOOK g_KeyboardHook = NULL; LRESULT CALLBACK cbHookKeyboard(int nCode, WPARAM wParam, LPARAM lParam); int main(int argc, char *argv[]) { g_KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, (HOOKPROC)cbHookKeyboard, GetModuleHandle(NULL), 0); while(true) { } return EXIT_SUCCESS; } LRESULT CALLBACK cbHookKeyboard(int nCode, WPARAM wParam, LPARAM lParam) { if(nCode == HC_ACTION) … | |
Hi all, I have a question here.. I am using microsoft visual C++ 6.0 with SP4 and SP5.. I call a `DoModal()`, but there was nothing dialog show out.. below are my codes.. CDlgA oDlgA; oDlgA.DoModal(); but no dialog show out.. then I trace the debug code, found out that … | |
Hello, and thank you for taking the time to help me! This is my first real program in C++, and I am still getting used to the differences between C and C++, so I still really don't know what I'm doing. I am working on a header file and its … | |
Hi! I'm running Ubuntu 9.04 and using Code::Blocks as C++ IDE. I have the following code: Temp.h: [CODE]#ifndef TEMP_H_INCLUDED #define TEMP_H_INCLUDED template <typename T> class Temp { public: Temp (T d = T(0)): _dato(d) {} T getDato () const; void setDato (T d); private: T _dato; }; template class Temp<double>; … | |
My professor likes to give us tests on topics we've not covered yet, like string stream :o This program uses stringstream objects to make sentences like the Mad Lib ™ game. Create 4 string objects: noun, adjective, verb, and adverb. You will need these functions: AskNoun, AskVerb, AskAdjective, AskAdverb, and … | |
Alright, so I'm a bit lost as to what to do next with this and am looking for some direction. The assignment sheet is as follows: [QUOTE]CSC 265 – Fall 2009 – Program 1 Due: Thursday October 8, 10 minutes before class starts Write a header file, implementation file, and … | |
| |
Hi :) I have this assignment for my first year programming module and one of the questions asks for a void function using string parameters. This confused the hell out of me, but I came up with this idea. Would someone please, please, please have a look at it and … | |
Hi all, Here is the problem; I’m trying to make two threads draw pixels in two different memory spaces at the same time. Nothing fancy, just a test program to learn about thread programming. I allocate the memory, send the address as parameters to the two threads, and in each … | |
im lost making a code that runs this. it has to include "while" command but im having difficulty with the counter vs the name =/ can someone help [COLOR="Green"] Enter your friend’s name(stop to quit):john Enter your friend’s name(stop to quit):megan Enter your friend’s name(stop to quit):stop Congratulations you have … | |
hii i have problem with the line [CODE]CopyFile ("\\svchost.exe","c:\\%windir%\\svchost.exe",0);[/CODE] i have already tryed to put _T before ( but he won't compile CopyFileW' : cannot convert parameter 1 from 'const char [13]' to 'LPCWSTR' i want that copyfile the file copies to the windows map srry for bad english [CODE]TCHblabla … | |
i found this problem in c/c++ when i wrote this code int a=5,b; b=++a +(+=a + a--); it gave the output of b as 21 and when i wrote int a; int b=++a + (++a + a--); it gave b as 18 why the answers are varying for the same … | |
I have to write a program for my assignment that does a quote. It has to have a void function that validates a string and and integer entered. Other wise I would have solved the problem with a simple menu and integers. The entries has to be one of five … | |
I'm stuck on a homework problem. Just not sure where I'm going wrong, I think my code should work and it doesn't, and I'm not sure why. The assigned problem is: Recursive Multiplication: Write a recursive function that accepts two arguments into the parameters x and y. The function should … |
The End.