49,761 Topics

Member Avatar for
Member Avatar for Icebone1000

How I can do it? I want a constructor of a object to have parameters, this object is inside other class..the compiler say the class dont have proper default constructors..(error C2512) [CODE=C++] ... class Game{ private: Player P1; Player P2; public: Game(void);//constructor ... [/CODE] [CODE=C++] class Player{ private: int x;//player …

Member Avatar for NicAx64
0
167
Member Avatar for Zohar

Hi, new to the forum, I am currently studying the basics of C++ and we have an assignment in which we have to code a Sudoku validator. Basically the validator will ask for a file to be input, it will read the file and the user will be able to …

Member Avatar for Zohar
0
224
Member Avatar for brains89

The problem is A voltage source supplies a load through a resistor. The voltage source has a rating of 1000 volts and a power rating of 10000 watts. The resistor is 5 ohms with a power ratings of 118.975 watts. The resistance of the load may vary randomly between 200 …

Member Avatar for DemonGal711
0
81
Member Avatar for U_A_G

I have a program to write and im stuck. It runs but not properly. idk i think my "if" "else" statements are the problem. here are some sample runs Enter employee ID ====> 123 Enter payroll status (s/h/c)====> s Enter monthly salary ====> 5280 Employee ID: 123 Payroll Status: Salaried …

Member Avatar for DemonGal711
0
96
Member Avatar for power_computer

have to compute a function that calculates a sum in between a range let say user enters value of 10 and end value of 15 and then it is divided by a a divisor entered by the user say 2 I have the following code but its not working quite …

Member Avatar for power_computer
0
164
Member Avatar for Zcool31

[code=cpp] template<typename T> //T is a type which supports the dereference operator void foo(T& param){ //the type of expression *param is defined at compile time U = *param; //U is the type which *param returns } [/code] My question is: How can I implicitly determine the return type of performing …

Member Avatar for nucleon
0
97
Member Avatar for cpsc1892

I'm studying for one of my exam's and this is my first c++ class and my professor gave one of these questions for our study guide... and I'm having trouble with it. And since our final is open book and open notes he's not giving us the answers, and i've …

Member Avatar for cpsc1892
0
2K
Member Avatar for power_computer

Im looking to learn more and powerful functions like winsock to use in my dev C++ programs, Im more into the field of making application like that I really would want to learn all the necessary functions in winsock to make a simple ping program, I googled and search this …

Member Avatar for Ancient Dragon
0
177
Member Avatar for neoseeker191

When I run this program using the F or R choice the first output repeats twice, and I can't figure out why. The rest of the program works great. Prog8.cpp [CODE] #include "stdafx.h" #include "ModifyT.h" #include <iostream> #include <string> using namespace std; int main() { char ch; char exitLetter; char …

Member Avatar for SeeTheLite
0
147
Member Avatar for pt_solar

This is the question asked, your help is very much appreciated : One of your professors has asked you to write a program to grade her final exams which consist only of 20 multiple-choice questions. Each question has one of four possible answers:A,B,C or D. The file CorrectAnswers.txt , which …

Member Avatar for SeeTheLite
0
193
Member Avatar for pt_solar

hi I have a problem finding the lowest and highest selling product in this question. Can you please help me ? this is what I have . It also wants me to display the name of the salsa not how many jars were sold how do I include that in …

Member Avatar for pt_solar
0
772
Member Avatar for SndSystm

Hello! I'm new here and I'm trying to make a craps game as a project. When i get to a certain function where the player rolls and makes a point, then has to match that roll, I keep getting stuck in a loop. I'll paste the function that this takes …

Member Avatar for SndSystm
0
112
Member Avatar for xcruiser

I have an assignment to submit tomorrow. It gives me compiling errors. About 62 in VC++ 2008 and 42 in VC++ 6. I have written this code in one single file and it works fine there. One error that I can think of is with the declaration of class variable …

Member Avatar for seanhunt
0
1K
Member Avatar for StillCrazy

Hi everyone. I am new to this web site. Found it while doing some research. My need is as follows: I am modifying a healthcare Practice Management System for a company in Jacksonville, Fl. and the client wants to be able to create basic BAR and PIE charts. There is …

Member Avatar for Ancient Dragon
0
95
Member Avatar for meistrizy

Thanks in advance for your help. The problem is this: I am supposed to read an array from a file and ask the user to input a name to search for within the file. If the name is there then return the position number in the file, if not output …

Member Avatar for meistrizy
0
138
Member Avatar for Peyton

Hi there, The Wallis product is defined here: [url]http://en.wikipedia.org/wiki/Wallis_product[/url] I am having a problem with the following code, which attempts to approximate the product: [CODE]#include <iostream> #include <cmath> using namespace std; int main() { int n = 2; // initialise top counter as 2 for the first two terms int …

Member Avatar for greg022549
0
1K
Member Avatar for phoenix2391

Ok, I'm not too sure if this would be considered a matrix, but what I'm trying to do promts the user for 2 characters, and one integer. For example, say you key in * G 3 the cout would be... *G* G*G *G* If you keyed in % $ 5 …

Member Avatar for StuXYZ
0
80
Member Avatar for daviddoria

According to this: [url]http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13[/url] One way to keep only the function declaration in the .h file is to do this [code] ////////// file: Tools.h #include <iostream> #include <vector> using namespace std; template <typename T> T Sum(vector<T> &V); [/code] [code] ///////// file: Tools.cpp #include "Tools.h" #include <iostream> #include <vector> using namespace …

Member Avatar for tux4life
0
286
Member Avatar for ademsaykin

Dear AncientDragon I have been learning c++ for two months only. Now,I am trying to understand pointers in c++.Your advise always be helpful to me. As far I understand a pointer is an address.As an example p1(pointer1) has this {x1,y1} address.So Pointer2 has {x2,y2}. There should be three different files …

Member Avatar for Ancient Dragon
0
88
Member Avatar for southernd0529

trying to get the program to run but there is an error in line 31 (expected primary expression before else) i dont know what to do [code=cplusplus] // Devin Southern // COSC 112 - Spring 2009 // Dr Stone // Lab 9 // This program will use loop to keep …

Member Avatar for southernd0529
0
140
Member Avatar for pt_solar

I'm new to this and I'm a beginner at c++. I need some help with some questions that I've been trying to solve for hours. I think I got most of this one right but I got stuck at the wages array. This question says : write a program that …

Member Avatar for pt_solar
0
1K
Member Avatar for daviddoria

To remove duplicates from a vector, my first thought was to insert them all into a set, it would take care of the uniqueness of the elements, and then read them back out into my vector. However, I have a vector<Point>, where Point is a point in 3d space (ie. …

Member Avatar for daviddoria
0
210
Member Avatar for bluebird

The assignmento I have to write is to Derive a class DistSign from class Distance which contains inches and feet as a protected data, to add unary + or – to the distance. Write no argument and two argument constructor. Here is my program. I don’t know how to add …

Member Avatar for MrSpigot
0
85
Member Avatar for YingKang

This is a part of the problem in my homework. I have : int alpha[20]; int beta[20]; int inStock[10][4]; I need to write a function copyAlphaBeta that stores alpha into the first five rows of inStock and beta into the last five rows of inStock. my program is here, but …

Member Avatar for YingKang
0
265
Member Avatar for kuru225

Hello All I am having some problems with a C++ class that i am taking and after looking around on the web I am still lost. The assignment that I am working on right now is as follows: [ICODE]Two numbers are entered in from the keyboard. If the larger number …

Member Avatar for kuru225
0
164
Member Avatar for gnit

I'm trying to create a simulation for a service line at a super market. The program builds just fine, but when I run it, I get: "Debug Assertion Failed! Program:... File:c:\program files\microsoft visual studio 8\vc\include\deque Line: 97 Expression: deque iterator not dereferencable" [code=c++] #include "stdafx.h" #include <iostream> #include <queue> #include …

Member Avatar for gnit
0
117
Member Avatar for bluebird

hello everybody! As far as I understand, the functions that are only different in return type are not allowed. But how can I write the program for the following question? ***************************************** Create two classes DM and DB which store the value of distances. DM stores distances in meters and centimeters …

Member Avatar for Narue
0
161
Member Avatar for bluebird

In this program, although I use Ignore(1000,’\n’); why it does not show the title for tape. In fact, I don’t understand very well about Ignore(); what is the meaning of 1000 in that function? [code] #include<iostream.h> class Publication { char title[20]; float price; public: void putdata() { cout<<"\nEnter title:"; cin.getline(title,20); …

Member Avatar for Narue
0
320
Member Avatar for 11silversurfer1
Member Avatar for Nick Evan
0
153
Member Avatar for ganmo

Hello, I have some weird problem with this code. The problem is that when I use >> to read data a text file to vector. It will only add the first double and discard the rest. Anyway if I use array instead of vector it works fine. Anyone know what …

Member Avatar for ganmo
0
162

The End.