49,761 Topics
| |
I wan't use the multimap on my own templated class. The following is a working example with a builtin type. [CODE=c++] int dat[5] = {0,6,3,7,3}; typedef std::multimap< int, int > asso; asso dict; for (int i=0;i<5;i++){ dict.insert(make_pair(dat[i],i)); } asso::iterator pos; for(pos=dict.begin(); pos!=dict.end() ;pos++) cout << pos->first <<" next "<< pos->second … | |
Write a program that asks for the name of a pole vaulter and the dates and vault height (in meters) of the athlete's three best vaults. It should then report in order of the hieght (best first), the date on which each vault was made and its height. Input Validation: … | |
hi, I'm a Computer Engineering student from Portugal in the 2Âșterm. Last class' job was for us to use class and sub-class systems, creating a info system for vehicle types. I thought I was finished, but when I did the main file, the compiler shouted loads of errors that didn't … | |
hello,I would like to create a class for basic file operations-just reading and writing a line.There seems no error in my program but it doesn't output anything.I think there is a problem with the functions for reading and writing.Please help... [code=C++] #ifndef HANDLER_H_ #define HANDLER_H_ #include <iostream> #include <fstream> #include … | |
Hey, Does anyone know any good packages that include a way to create 2d ghx along with GUI for C++. what I've got atm is wxwidgets for GUI and allegro for 2d ghx. I do not know how to combine the 2. So if someone cud tell me how to … | |
I am drawing on a bit my, then re-loading the bitmap(to erase it) then drawing on it again at 100Hz. I am getting flicker. Is there a way to reduce this flicker? Or a better way to do this than to reload the bitmap everytime? Thanks. | |
Hey, ive written a piece of code which reads from a file called test.txt. all it does is use strtok to seperate the data from the spaces because there are alot of them, and then print them out, this worked fine when i did a test for just 1 line, … | |
I am having difficulty with nested loops. I am attempting to create a program that has the user enter monthly data during the course of a three year period. here is what I have so far. [code=C++] #include <iostream> const int Months = 12; const int Years = 3; int … | |
i need help removing spaces from a string..how do i go about this?? i have to report back the number of spaces too but ive been able to do that thnx (i dont want to use any of the string functions in the string library) [code] #include <iostream> int stripspaces(char … | |
Ive been given a task where i read in a line of text from a file, and then need to seperate that line into seperate strings, ive done this however I also need to keep some attatched... the file contains "abc def ghi jkl mno", this is read in using … | |
I have been working on this assignment for a while and cant get the end result to work. Can anyone help? Assignment [QUOTE]Write a function called sumTo that takes as arguments two integers. Your function should use a loop to sum all of the numbers between the two (This includes … | |
Sorry for asking the topic that asked before... but im still dont know how to use that.. Below is an example create by me.. I hope that someone can tell me which part have to fix ... This is the header file: [CODE] int check_SkipCard (string input) { int SkipCard=0; … | |
I have a problem with bulding a program to store a family record (genogram), this record consits of : name, birthday, married? and number of child. What is the best way to store this record??? Could you give me some example about some task on this structure : Input name … | |
I am using a List where I wonder how it is possible to find the MaxValue searching trough Value1[0] until Value1[3]. In this case it should return: 12 I have found a ::Max function but this will only consider the 2 values inside the paranthes wich then will return: 100. … | |
I am using this in the std:: to check for the first occurance of " " backwards (rfind). If I go managed .NET, I wonder if there is any simular method for this using str-> [code] std::string::size_type index2 = str.rfind(" ", index - 1); [/code] | |
Hey all, i'm a freshmen in college who is taking Intro to Computer Science with C++ and i'm just a beginner when it comes to programming so i have a problem. This is our assignment: [B]You are to write a program which inputs a Celsius temperature from the user, converts … | |
I am having a lot of trouble with a Divide and Conquer algorithm to count the number of white cells and white cell blocks in a grid of black and white cells. Here is my grid file "cells.txt": w = white cell b = black cell [CODE] bbbbbbbbbb bwwwwwbwwb bbbbbwbwwb … | |
every time i make my own rounding routine with precision, i see my compiler suggesting a function long double round(long double x, int precision); so i was wondering if someone knows what library it comes from, i surely wasn't able to find it... thanks | |
| I am trying to write this program that requires the following for C++: Write a c++ program to simulate the roll of a die. In principle, each of six possible outcomes is equally likely. -The program will prompt the usesr to enter the # of times the die is to … |
Hello, Here's the details: User inputs sentence Program checks sentence for 3 magic words ("chicken", "egg", "rooster") Program keeps count of every magic word found and displays results Here's my code: [code=c++]#include<iostream> #include<string> using namespace std; const string chicken( "chicken" ); const string egg( "egg" ); const string rooster( "rooster" … | |
I am working with fifo module...I actually found the basic code on DaniWeb, just made a few changes to it... There are 2 main sources...first one is called fifoqueue which consists of basic fifo functions i.e. qu, dequ, isEmpty and a couple more...the second one is called packetstructure which is … | |
All right so I'm learning C++ via library books and the information isn't too helpful, but it's the best I can find. Most of the books at my library are older than I am - copyright 1993 - some even earlier. So it's kind of ironic how the [seemingly] simplest … | |
this program is running, but the problem is., the function that I called didnt give me the accurate answer.. if you looki into my source.. what was the problem?? is the formula?? or the wrong way of calling functon?? or the whole source of my program.? this program should able … | |
I compiled this code in dev c++ and i got 0 warnings and 0 errors, so it was a clean compile and whenever i run the exe i get this error which says assembler.exe has encountered a problem and needs to close. And gives me the error report thingy for … | |
Hi I am working on school project to build an application to communicate between laptop and robot using bluetooth. I have basic understanding of C++. Does anyone know about any tutorial or some sort of guideline on which i can start my work on. Your help will be highly appreciated … | |
Hi, This is my first post, this site has been very helpful in the past. I am wondering if it is possible to assign a dynamic array to a vector? If so, how? The following code is not working for me (with Visual Studio .NET 2003): [code] int *current; current … | |
Hello I have written my program and right now I am stuck in something that I thought that was going to be easy. I have the [B]char buffer[/B], which receives from the serial port some letters and 2 numbers at position 3, lenght 2. I want to extract those numbers … | |
Okay, so im new to this website/forum. I am in programming 12, and as my final project in C++ I have decided to create an address book application. It will be "simple" and I was hoping to be able to get it to be able to: 1) Create new entry. … | |
Can someone please explain how to create a makefile? I'm somewhat confused by what I've read on the web thanks | |
[code=cplusplus] #include <iostream> using namespace std; class Month { public: Month (char char1, char char2, char char3); // Precondition: The parameters contain the first three characters // in the name of the month - all lowercase. // Postcondition: The member variable month has been set to // the integer value … |
The End.