49,761 Topics
| |
Hi all, I am very new so excuse the messy code. I am just trying to get this code to work properly first before cleaning it :p . For now I want it to: if user types "no" exit, if user types "yes" then run the next part, or if … | |
I'm haveing a hard time determining wether i should implement certain things as a class or just functions....for example.... Log.h library <--- i could obviously implement a Log class....and i could also have use Log functions(without a class) alternatively...is there any guideline/recommendations i should use when knowing wether i should … | |
Can someone help me with this? I No matter what I do, when I press F9, the message box pops up showing F9, But when I press F10, the message box for F9 pops up.. Is it because MSG msg and MSG msg2 are the same?? How do I fix … | |
Hi, I was given the following problem, I've almost got it but I've hit a roadblock and having no luck getting past it. Here is the problem im supposed to solve... The function insert of the class orderedLinkedList does not check if the item to be inserted is already in … | |
I am reading this book called "C++ From the Ground Up". I saw this and it makes perfect sense // Using a reference parameter. #include <iostream> using namespace std; void f(int &i); int main() { int val = 1; cout << "Old value for val: " << val << '\n'; … | |
Trying to make a quick little tool in response to the [URL="http://www.msnbc.msn.com/id/42348642/ns/technology_and_science-security/"]FBI's request for assistance[/URL] on cracking a code.. getting an error that takes me outside the scope of my program.. not sure what is causing the problemo. Maybe another set of eyes can help: [CODE] #include <iostream> #include <fstream> … | |
Once I was trying to create an object inside a switch statement. It looked something like this. [CODE] cout >> "Enter how many objects you want to create: "; int nofobjects; cin << nofobjects; switch(numberofobjects) { case 1: objectclass object1; break; case 2: objectclass object1; objectclass object2; break; case 3: … | |
[CODE]// Finals.cpp.cpp : Defines the entry point for the console application. // #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { #include <iostream> #include <string> #include <iomanip> using namespace std; // //CLASS DECLARATION SECTION // class EmployeeClass { public: void ImplementCalculations(string EmployeeName, int hours, double wage); void DisplayEmployInformation(void); void Addsomethingup(void); string … | |
how can I declare linkedlist (the ready implemented linkedlist in c++) | |
I am quite confused on the following terms...are all the following terms all the same way to pretty much say "nonmember function" ( function that works with a class that isnt apart of its public interface ) [B]auxillary function helper function free function utility function[/B] | |
I've been trying to think of the easiest way to calculate the average and display the results. The two outputs that I am missing would be the average part of the program. When the program is ran, it should display "Danika Patrick averaged a score of 120 in 11 minutes … | |
I don't understand why goto's are so bad. I LOVE to use it in an if-else or switch to quit a loop. But everyone says they are bad and I should not use them but no one says why! Can you explain it to me? | |
Hey guys I'm trying to make a directdraw program to output certain statistics but it's not drawing fast enough. Does anyone know how to increase ddraw update speeds? Thanks in advance! | |
I don't fully understand what is wrong with my code, it will read the first lines of any text file but then overloads and keeps displaying "0.00" and then crashes the program. I'm trying to get it to read student's last names and read their GPA scores, and the sentinel … | |
Okay here's what I have so far... The error I receieve is below... The HCP Header File [CODE] #ifndef HEALTHCAREPROVIDER_H #define HEALTHCAREPROVIDER_H #include "stdafx.h" #include <string> #include <iostream> using namespace std; class HealthCareProvider { protected: string fullName; string profession; int yearsExperience; string companyType; string apptAvail; double bill; double fee; public: … | |
Hello! I have written a nested for loop with an inner loop of 86400 iterations and the outer loop 365. It compiles and everything but only gives me 97 of the 365 results. This is the error message: [CODE]aqua(855) malloc: *** mmap(size=268435456) failed (error code=12) *** error: can't allocate region … | |
I know printf prints to "stdout" how exactly can I change the pointer to a class of mine that i'd prefer to handle the output string? or is it better to just process using sprintf and manage the strings? Would there be any issues with the first method? | |
Hello everyone, i want to ask how do we allocate memory for 2D array using pointers with 2 different inputs of rows and columns? Furthermore, i want to know how do we access different members of that particular array through pointers? | |
[CODE] int main(){ // I have an error in the next line read_file("F:/2nd year_2/Data structure 2/books/lecture-26.pdf"); return 0; } string read_file(char* address){ string line; ifstream myfile (address); if (myfile.is_open()) { while ( myfile.good() ) { getline (myfile,line); cout << line << endl; } myfile.close(); } return NULL; }[/CODE] this program … | |
i have part of a text based game that keeps track of the HP , DEF... and such. it needs to be able to replace the current value for the variables, in which case are: [CODE]long HP, def, sheild;[/CODE] for instance, you battle a monster and the attack does 75 … | |
I tried to write up a test program that uses std::copy and istream_iterator to copy one text file to another. But it doesn't work because the '\r' and '\n' in the file are lost. I've tried opening the input and output files in text mode and I've tried opening them … | |
Hi all, I'm having an issue with updating an XML that already exists. I have no problem creating an XML but when it comes appending to the end an existing xml nothing happens. I dont get any error messages so I'm not sure what I'm missing, the first part where … | |
Is this ok to do or have i forgot my manners?Thank you [code] struct A { virtual A* func()=0; }; template <typename T=int> struct B : public A { A* func () { return this; } }; typedef B<> B_int; typedef B<float> B_float; struct C : public B_int { A* … | |
Hi, I have been programming in C for some time and now I am trying my hand at C++. As we all know, global variables are baaaaad... However, I am developing a collection of classes and I need them all to share a common variable (a time step) whose value … | |
Write a program that will accept a text file and echoes all of the words to the terminal and places a single space character between consecutive words. Words are composed of alphabetic characters only. Your program should write only five words on each lin, separating words on a line by … | |
Hey guys i'll show the code first then explain my problem: [code=c] Class A { /*Variables required by A, B, C and D */ /*functions required by B and C*/ }; Class B { /*some of it's own functions and variables*/ }; Class C { /*some of it's own functions … | |
[CODE]// Hangman Redo Program #include <iostream> #include <string> #include <cstdlib> #include <ctime> #include <string> #include <vector> #include <algorithm> using namespace std; //Functions void instructions(); void game(); // Types and Arrays string choice; string inst; const int MAX_WRONG = 8; vector<string> words; const string THE_WORD = words[0]; string soFar (THE_WORD.size(), '-'); … | |
can anyone explain why the output of this code is 110 ? [CODE]// Assignment 1-Body Mass Index Calculator #include <iostream> //allows program to output data to the screen using namespace std; //function main begins program execution int main() { int total=0; for (int number =2;number<=20;number+=2) total +=number; cout<<"Sum Is"<<total<<endl; return … | |
So I have the program written, but for some reason, when I go to compile it, the display box pops up and then disappears right away. Can you please help me to figure out what I did wrong? [CODE] #include <iostream> #include <iomanip> #include <cmath> #include <string> #include <fstream> using … | |
write a program to print how many times each word appear in the file. |
The End.