49,761 Topics
| |
I have a list from the stl called Clist. It has alot of items in it and one is a double called fVal. I want to insert new nodes in the list in ascending value according to the fVal. I have tried the following code and it works fine for … | |
We are doing an assignment that reads from a file on the hard drive, asks for user input and then writes it to a different file on the hard drive. We have to use three different functions, besides the main, and cannot use global variables. I cannot seem to get … | |
Hi all Could someone please explain this program to me, especially lines 25 and 30. I understand that line 30 is a for loop and I understand how it works. However, I am unclear why it is minusing 3 from n and is n the variable passed from line 14? … | |
This is likely a stupid question, but I can't figured out by myself how to pass a pointer to a member function of a templatised class in its own template parameters. More clearly: I would like to have this to work out: [code]template <typename T, T test::* PtrToMember> class test{ … | |
Which is better Double Buffering or assigning to a Static Control. I would like an example of double buffering or both. This is my bitmap code. [CODE] #include <windows.h> #include <tchar.h> #include <stdlib.h> #include <string.h> #include "Menu.h" #include "Icon.h" LPCTSTR ClsName = L"App"; // Class name LPCTSTR WndName = L"WindowsAPI"; … | |
I'm developing a doubly linked list. Now the way I'm currently navigating it is by using a current position pointer, that starts at the tail and then loops round however many times you need (you'll tell the function) and it will then get to that node. Now, I'm having to … | |
Hi, coders. I have to overload operators +, *, =. Object L3(default "abc") must be smth like this "aabbcc"(operator*; double each symbol of the string). Then I must concatenate Object2 and Object3(operator+), and initialize Object1(operator = ). I have strange errors error C2296: '*' : illegal, left operand has type … | |
The program asks to input an integer larger than one. the number is then passed into a function that calculates the sum of squares from 1 to that integer the output should be the value of the integer and the sum(labeled). A negative input value signals the end of the … | |
Cant figure out whats wrong with code. This is code should "write a program to compute the interest due, total amount due, and the minimum payment for a revolving credit account. The program accepts account balance as input from a file, then adds on the interest to get the total … | |
hi guys, im trying to do map in cpp using STL and when i ran a simple program it was showing error that: error: nomatchfor'operator<<'in'std::cout<<(&mp0_iter)->std::_Rb_tree_iterator<_Tp>::operator* [with _Tp = std::pair<const int, int>]()'.... my program was like this: [code=c++] #include<map.h> #include<iostream.h> int main() { map<int,int>::iterator mp0_iter; map<int,int>mp0; map<int,int>mp1; mp1.insert(1,13); mp1.insert(2,16); mp1.insert(3,17); for(mp0_iter=mp1.begin();mp0_iter!=mp1.end();mp0_iter++) … | |
Say I have an array: array={1, 2, 3} but I want to be able to increase the size, and shift the data to the front, leaving 0's behind. So i want the array to turn into this: array={1, 2, 3, 0, 0} Where I added two to the size of … | |
This exercise had me build on an earlier program - first ask user if wants to compute, then (if yes) choose circle or rectangle, then prompt for appropriate inputs, calculate, and run again. I had a major brain freeze, such that this has taken me many hours just to get … | |
Can someone help me with this???? [CODE]/****************************************************/ /* File: name of your file with the source code */ /* */ /* Created by: give your name */ /* Date: give the date */ /* */ /* Program to find the maximum of three */ /* floating point numbers */ /* … | |
Is there a way in C++ to handle unexpected errors? Other languanges I have learned tend to allow this but for some reason I cannot get the try/catch solution to work in all cases. Take the following example: [CODE] int main(){ vector<int> v; try{ //next line should cause an assertion … | |
Hello all, I recently was reading some code and i found something along the lines of this: [code="C++"]void GetText() { int* size = new int; // ....... // lots of code here // ....... size = new int; // crap here }[/code] ^^ as you can see size is 'new'ed … | |
I am trying to read and write a text file into an array and then store it back into the text file. The main problem i am having is the storing the file character by character into the 3D array. Here is my code: [code] #include <iostream> #include <fstream> using … | |
[CODE]class Array { public: Array (int newSize, int order); Array (const Array& original); ~Array (void); void write (ostream& outfile, char* sortName, char* orderName); int getSize (void); void insertionSort (void); void selectionSort (void); void bubbleSort (void); static void initShellH (void); void shellSort (void); void heapSort (void); void quickSort (void); void mergeSort … | |
I am writing a Savings account program using a class with methods but it won't compile. I can't seem to figure out why. Hhere is my program. It contains an header file, source code file, and a program cpp file: Here is part of the error I get, C:\Users\JEFF~1.JEF\AppData\Local\Temp\ccWScaaa.o(.text+0x17a) In … | |
I developing a small program that I want working as a widget, and would like to display it only when no window has focus - or when the desktop window has focus. My best chance now is finding whether GetFocus() returns NULL but this is not working as suspected. I've … | |
for starters im just learning C++ so forgive my ignorance... that being said... i need to pull 3 bits of info out of a text file. - Last name (name) - stored as a string - First initial (initial) - stored as a single character - Account balance (account) - … | |
I want to download Image file from web using c++ and save it in specified folder. How to do it?... please help me. | |
[url=http://cc.byexamples.com/2007/04/08/non-blocking-user-input-in-loop-without-ncurses/]code from this blog[/url] [code]int kbhit() { struct timeval tv; fd_set fds; tv.tv_sec = 0; tv.tv_usec = 0; FD_ZERO(&fds); FD_SET(STDIN_FILENO, &fds); //STDIN_FILENO is 0 select(STDIN_FILENO+1, &fds, NULL, NULL, &tv); return FD_ISSET(STDIN_FILENO, &fds); }[/code] [code]void nonblock(int state) { struct termios ttystate; //get the terminal state tcgetattr(STDIN_FILENO, &ttystate); if (state==NB_ENABLE) { //turn … | |
I have a simple display() method that essentially looks like this [CODE] #include <stdlib.h> #include <iostream> #include <iomanip> #include "Pieces.h" using namespace std; void Pieces::BeginInstruct(int& i){ cout<<endl<<endl; cout<<i++<<":"<<setw(5)<<"Open the program."<<endl <<i++<<":"<<setw(5)<< "Click \"File\" and then\"New\"." <<endl; } [/CODE] Theres obviously more but what I am concerned with is that setw() … | |
Been studying what I thought was a fairly authoritative article about BSTRs by Bruce McKinney... [url]http://www.ecs.syr.edu/faculty/fawcett/handouts/cse775/Presentations/BruceMcKinneyPapers/COMstrings.htm[/url] where he states that the four bytes before the start of the BSTR contains the string's length. Here is the exact quote... [QUOTE] What Is a BSTR? The BSTR type is actually a typedef, … | |
The essential problem is to determine the index i of the first Fibonacci number Fn to have at least d digits. The specific challenge is to determine the index of the first Fibonacci number to have 1000 digits. Obviously, this problem could be brute forced by stepping through all the … | |
How would I get the code below to time both the iterative version and the recursive version of the Fibonacci function so that I can see which one is faster. I already have the timer.h file to go along with it. I'm thinking i should use t.start() and t.stop() to … | |
Basically, I need to figure out how to change a buttons text when its clicked(X or O). [code] button1 = CreateWindow(TEXT("BUTTON"), TEXT("1"), WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 10, 10, 50, 50, hwnd, (HMENU)ID_BUTTON1, myInst, NULL); [/code] Im using buttons like this. I have it set up in the WM_COMMAND case … | |
Hi all, I have a question that , can we use java program as c++ program? Means, when we compile a c++ program we get a .exe file and we can run it anywhere or send to any one. Is the same possible in Java? As I know java creates … | |
Hi guys, I'm implementing a viewer for skinned character animation. Each frame of animation requires thousands of (4x4 matrix * vector) and (float * 4x4 matrix) calculations. This is the section that is repeated thousands of times: [code] // For each vertex influenced by bone for (int j=0; j<(int)Character::bones[i].get_vertices().size(); j++) … | |
I am making a linked list template. a can search a string input and determine if it is an int. i can declare a node of type int or string. when i try to add to my list, my string node cannot point to an int node and vice versa. … |
The End.