49,761 Topics
| |
What i am trying to do is pass an array of structs to a function. the code i have so far follows: [code=C++] struct Contribution { string name; double amount; }; const int MAX = 25; typedef Contribution BigSpender; typedef BigSpender ContributionRec[MAX]; const string NAME_FILE = "names.txt"; const string CONTRIBUTION_FILE … | |
Hi.I need an answer to my heap problem. I am creating a 1000 items priority_queue (priority_queue<Molecule*,vector<Molecule*>,SortClass>); Sometimes I need deleteThis(Molecule *mol) function.So this function can delete any item at any index.Pop wont work here if I dont use pop-push until the target.But this takes long time.So I want to learn … | |
I have this programming but I want to sort the total in descending order... How to make an examid together with total after has sort the output? [code=C++] #include <iostream> // std::cout #include <fstream> #include <iomanip> #include <string> // std::string #include <vector> // std::vector<> #include <algorithm> //std::for each() using namespace … | |
I am on my last assignment and i have no idea how to do or start this one. This class has gotten to where i understand nothing when i watch the lectures. I have invested so much time trying to learn this stuff and i do not get structs. This … | |
I'm being given the assignment of using the selection sort method to alphabetize a 2D array of names. Specifically I am supposed to modify a selection sort algorithm for integers and convert it for my purposes. I took the skeleton code and tried to convert it. The program compiles and … | |
Hi, I was given this problem: "The user will enter two letters. These letters will be stored in a string using cin.getline. Replace the first letter entered with the second letter entered." The next problem we have will be to replace the letters in a sentence, but I'm stuck on … | |
| Hello. I am new this website and a beginner in Computer Science. I have very little experience in C++. Recently I have been working on this lab and I am stuck at a point where I don't know what to do. Can any1 help me with this code? Here is … |
using visual studios C++ express 2005 edition this is my code but when I run it I get a bunch of garbage...any suggestions would be greatly appreciated!!!! [code=cplusplus] #include <iostream> #include <fstream> using namespace std; int length(char phrase[]); void concat(char phrase1[], char phrase2[], int measure1); void copy(char phrase1[], char phrase2[]); … | |
Hey guys, I'm new here, I looked through the help also searched and couldn't find anything that helped. Although I will be using the Algorithms you guys have on this site. anyways I only took a intro course to C++ about four years ago and don't remember much I wrote … | |
This is probably the most frustrating thing in c++ for me. I can handle compile errors just fine, but when I get a core dump, I get so frustrated, because I have no idea where the problem is, especially when I have 300+ lines of code to be looking at. … | |
hi my name is john i have been trying to learn how to design my own software. i have been told in order to i must learn c++ i have just download Visual C++ Express Edition am not to sure what i am doing so if anyone could give me … | |
Hey i've made a simple calculator, but i was thinking about adding a square root option.. But is there a actual way to do this or would i have to create my own?? PLEASE REPLY A.S.A.P | |
| I searched the forums for Windows API tutorials and have found [URL="http://www.winprog.org/tutorial/"]this[/URL]. Is it necessary to do everything manually like in the tutorial and after getting the hang of it move on to QT or should I jump into QT right now? |
sort of a noob as i have been doing c++ for only a couple months now. my problem is that i am using a function to pass data from a file into an array then into a .out file. the function im using to read the data from the file … | |
I have to write a computer program to play connect 4 against a human player by friday. I have no clue even where to start on this. I have already written the game, i just dont know what to do about the computer player. Please Help me!!! p.s. What is … | |
I keep getting this error: this application has failed to start because MFC80.dll was not found. In the past, when I've got this error i've played around with "Runtime library", switching it from /MDd to /MD to /MTd......etc etc then I turn off and on the manifest files then I … | |
Hi all! i write because ive a little problem with a c++ binary tree. I wrote all the cose, and the program runs, but i have a dubt: the destructor and the copy constructor. i wrote in 3 files: nodo.h, albero.h and albero.cpp (nodo means node, albero means tree) [code] … | |
what kind of variable is UINT anyway..........? in VC++ Anyone can help me? I still cann't understand it's detail usage. :-/ :icon_question: | |
hi there i was wondering if any1 could help me with this problem. i am a beginner at c++ and my coursework is asking me to create a program with a hash function and i am lost! could any1 tell me how to implement this? here is my problem - … | |
I have a program that provides different responses each time it is ran. I created it via an empty project and the output is simple cout statements to the DOS window. Is there a way to convert a C++ program I created into an Windows application that displays output and … | |
I seem to be able to write as many characters as I want into "buffer" even though I declare it as length 1 - why is this? [code] string teststring = "teststring"; cout << teststring << endl; char buffer[1]; itoa(34567,buffer,10); teststring.append(buffer); cout << teststring << endl; [/code] Thanks! Dave | |
I was just asking, is it also possible to define 2D arrays? If so, how do I pass them into the functions and use them in an address book? As in can I say employee.name[x][] when I use things like strcmp, puts, or gets, or must i say employee.name[x]? | |
Problem Description: You are to write a golf game that allows the user to play one hole, a 280 metre par 5. For each swing, the player chooses a club and then the program generates the distance hit for each shot, updating the distance to the hole accordingly. Play proceeds … | |
I need to use a for loop to print out the odd numbers between 25 - 1. program2 1) I also need to use a for loop to prompt user to input two intergers: firstNumber and secondNumber (firstNumber must be less then secondNumber) 2) Outputs all odd numbers between firstNumber … | |
Hi All, This is regarding VC++ 6.0 compilation problem that i have faced . I deleted my "Temp" folder and trying to compile my code , but VC++ doesnt allow me to compile my code without that folder .can anyone help me in this ? why VC++ requires temp folder … | |
Hi all, I am currently working on a program which tests whether 2 numbers multiplied produces a PALINDROME. An example of a palindrome is 16461 which can be read same from both ways hence i devised a test. [CODE=cplusplus]#include <iostream> #include <string> using namespace std; char pali(char orig[100]); int main() … | |
i am having problems with this assignment : Write a program that prints an N by N box on the screen as follows: Please enter a number between 2 and 10: 5 ----- | | | | | | ----- Press any key to continue . . . Note that … | |
| What's the best way to swap two arrays? Would it be better to copy each position into a new array and then assign the array a new name? Or would it be better to use pointers? What would the algorithm be if I were to use pointers or a dynamically … |
Hey, im trying to use pointers with a struct. I am having an issue in the function searchData. I can not get the pointer to compair with the string, it is still just compairing the actual adress or something else. Not sure if i even passed it right. Please help … | |
this is what I have so far. I did most of the work just that my output is screwed [code=cplusplus] #include <iostream> #include <fstream> #include <stack> #include <cmath> #include <cassert> using namespace std; int number(); bool Valid( stack<int> s, int row){// This will find out if there is a valid … |
The End.