51,593 Topics

Member Avatar for
Member Avatar for oggiemc

Hi, Im getin the following error when i try the code below..Anyone tell me whats wrong?? (name is defined in animal class).. 52 C:\Dev-Cpp\oopAssign1.cpp no match for 'operator>>' in 'std::cin >> name' [code=c++] void Animal::arrayDisplay(){ string name[3]; cout <<"Input 3 names:" << endl; for(int i=0; i<3; ++i){ cin >> name; …

Member Avatar for oggiemc
0
118
Member Avatar for shasha123

Build a program that determines monthly payments for a loan. please add problem statement and pseudo code? Use these parameters: (1)Loan amount as a float (2)Number of months for the loan as an integer (3)Monthly interest rate expressed as a decimal as a float. Please do not pass the annual …

Member Avatar for Fbody
0
83
Member Avatar for crossbow25

[CODE] #ifndef VECTORBINARYTREE_H #define VECTORBINARYTREE_H template<typename Object> class ArrayVector{ private: int capacity; int sz; Object* a; protected: void overflow() { capacity*=2; Object* b=new Object[capacity]; for(int i=0;i<sz;i++) b[i]=a[i]; delete []a; a=b; } public: ArrayVector(int initCap=16){ capacity = initCap; sz=0; a = new Object[capacity]; } int size() const {return sz;} bool isEmpty() …

0
88
Member Avatar for aaronmk2

My profesor added this line of code to a bubble sort saying that it made it more efficient by tracking the last swap. I don't understand how this would work [CODE] void bubble_sort(int a[], int n){ while (0<n-1) { int last =0; for (int i=0; i<n-1; i++) { if (a[i]>a[i+1]) …

Member Avatar for Fbody
0
3K
Member Avatar for FumarMata

Hello I want to pass a bidimensional vector to the constructor of all instances of [ICODE]MyClass[/ICODE]. All instances must use and share and modify the same vector. And I want to keep a reference to that [ICODE]main_vector[/ICODE] to use it later in the program I am passing it by reference …

Member Avatar for Fbody
0
201
Member Avatar for nonshatter

Hi all, I have virtually no knowledge of C, but I have a problem with one of my scripts. It runs fine on a 64-bit Linux machine, yet it gives me a seg fault when run on 32-bit linux. gdb tells me that the seg fault occurs on line 314. …

Member Avatar for mitrmkar
0
116
Member Avatar for shakssage

Hello. I've got a problem that I haven't been able to solve after a long time searching. It's a simple problem. I have two forms. 1) Form1 2) Form2 I need to get from Form1 to Form2 and vice versa. I can get from Form1 to Form2 easily, but I …

Member Avatar for shakssage
0
396
Member Avatar for tikoti

Hi everybody! I am trying to use fork() and wait to perform a simple task with c++ but I have noticed that the performance is quite different from what I expected. [CODE] #include <unistd.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int number = atoi(argv[1]); int i; …

Member Avatar for tikoti
0
3K
Member Avatar for avataralien

I wanted to do a simple date validation to disallowed string from entering when prompt. Pls guide me. Tks. Eg, "Enter the publish date in DD/MM/YYYY : ghghjb "Sorry, pls enter in DD/MM/YYYY" "Enter the publish date in DD/MM/YYYY : [CODE] # include<iostream> # include<string> using namespace std; class date …

Member Avatar for Taywin
0
105
Member Avatar for .waterboy

This is the problem: [url]http://www.ntnu.edu.tw/acm/ProblemSetArchive/B_VV_Asian/1997/ProblemF.html[/url] I just need the code badly.. Pls. Help Me..

Member Avatar for iamthwee
-2
79
Member Avatar for Nathaniel10

An exercise that Stroustrup wants the reader to do is understand the output of the following program. [code] #include "../../std_lib_facilities.h" struct X { int val; void out(const string& s, int nv) { cerr << this << "->" << s << ":" << val << "(" << nv << ")\n"; } …

Member Avatar for Nathaniel10
0
87
Member Avatar for wazzer225

Hello I'm trying to iterate backwards through a vector. with a while loop it works fine. prints out: 12 8 4 1 However the for loop prints 196735 12 8 4 Could you please tell me why this is. Probably something wrong with my logic i don't know I'm using …

Member Avatar for mitrmkar
0
115
Member Avatar for txwooley

My rand() isn't very random. As a matter of fact, it's not random at all! I am running Ubuntu 10.04 on both home comp and laptop. When I execute the code: [CODE]#include <iostream> #include <cstdlib> using namespace std; int main() { int x; x = rand(); cout << x; return …

Member Avatar for Fbody
0
98
Member Avatar for Tiny_trixer

Again I come crawling for help... I made a program that makes coordiant points and lines with these coordinates. A new class is going to inherit from the class with the lines, and calculate the distance between a line segment and a point. I found the correct mathematical formula. With …

Member Avatar for Tiny_trixer
0
135
Member Avatar for zhe05303

Using Object Oriented Programming, create an encryption/decryption program. Your program must be able to a. Ask the original text file name from user. b. Ask the destination text file name from user. c. Ask for option encrypt or decrypt. d. read from a source text file e. write to a …

Member Avatar for jonsca
-1
100
Member Avatar for bawbawbiscuit

Hi, I created a program that makes a multiplication table, I dont know where the .txt file is located after executing the program Im using turbo C++ :-/ [CODE]#include<iostream.h> #include<stdio.h> void main(){ int multiplicand; int multiplier; int toprow; int column; int repeater; FILE* Starter=fopen("[COLOR="Red"]multiplication.txt[/COLOR]","w"); cout<<"Insert the number of repetitions: "; …

Member Avatar for bawbawbiscuit
0
107
Member Avatar for dorien

Hello everybody, I am looking for a good C++ midi API. I have written a program in C++ that needs to be able to export MIDI. So far I had written my own export function, but I feel that the complexities of low level midi coding will become to great …

Member Avatar for dorien
0
397
Member Avatar for smoothe19

I am attempting to edit this Queue class to only use myBack pointer, i began having errors and now I am lost.... LQueue.cpp is as follows [CODE]/*--- LQueue.cpp ---------------------------------------------------------- This file implements LQueue member functions. -------------------------------------------------------------------------*/ #include <new> using namespace std; #include "LQueue.h" //--- Definition of Queue constructor Queue::Queue() : …

Member Avatar for akgh2010
0
180
Member Avatar for prestonprice57

I am working on a project for school and I can't get my readFile function to work. There is something wrong for the arrays that I am putting in. Here is the text file I am trying to read from: 4 Assign1 200 10 Assign2 100 80 Project 100 45 …

Member Avatar for WaltP
0
96
Member Avatar for jalenamichelle

im trying to convert julian date to calendar date and vice versa im not getting any errors, but the output im getting is ridiculous. any help is appreciated [code] #include "stdafx.h" /* int _tmain(int argc, _TCHAR* argv[]) { return 0; } */ int isLeapYear(int year){ return ((!(year % 4) && …

Member Avatar for WaltP
0
120
Member Avatar for oggiemc

Hi, Ive been given an assignment in college to implement a dog class and to include functionality such as eating,sleeping,barking etc..im not really familiar with writing code to describe living things so just wondering could anyone give me a few suggestions as to how to go about doing this? I …

Member Avatar for oggiemc
0
120
Member Avatar for newCoder1545

Here is what i need the PRG to do... Assignment #4 When you toss a coin, generally, you don't get too many heads or tails in a row, but if you toss enough times, eventually you will get a number of heads in a row or tails in a row. …

Member Avatar for WaltP
0
143
Member Avatar for milkypolar

Need some help here. Why after I insert the node, it loop back to insert node again, and it not back to the menu. [CODE] #include "stdafx.h" #include <iostream> #include <string> #include <iomanip> #include <sstream> using namespace std; struct place { string cityName; place *left, *right; }; string myStr; void …

Member Avatar for milkypolar
0
102
Member Avatar for slychronic

hie guys have a textbook that am reading there is a code that i need some help understanding better....can anyone explain to me line by line whats really going on.... No need to explain the main function though.......its a program that calculates permutation of whole numbers...Cheers! [CODE] #include<iostream> #include<conio.h> #include<string.h> …

Member Avatar for jonsca
0
122
Member Avatar for nehru1947

Hey Im having trouble building a hangman game and I cant get it to build here is my code if anyone can help [CODE]#include<conio> #include<string> using namespace std; main(){ char word[30],getit[30],*found; int score,loop,len,num,lup,om,luptimes,times,fitimes,ondtimes,antimes; luptimes=0; fitimes=0; ondtimes=0; clrscr(); printf("\n ENTER THE WORD: "); gets(word); score=0; num=0; om=0; len=strlen(word); clrscr(); char gname[70]; …

Member Avatar for WaltP
0
119
Member Avatar for dotbat

Hey everyone, I have a quick (and hopefully simple question). I'm writing a simple program that will ask the user for two different inputs(IP address and message), save those as strings, then run a command in command prompt adding those strings on the end as arguments. I'm using it to …

Member Avatar for dotbat
0
311
Member Avatar for rebellion346

Hey guys, I'm getting a few errors I can't seem to figure out solutions for: (SalesEmployee Line 21) error C2248: 'SalariedEmployee::salary' : cannot access private member declared in class 'SalariedEmployee' (SalesEmployee Line 17) error C2664: 'SalariedEmployee:: SalariedEmployee(const SalariedEmployee &)' : cannot convert parameter 1 from 'std::string' to 'const SalariedEmployee &' …

Member Avatar for rebellion346
0
92
Member Avatar for .waterboy

Problem: [url]http://contest.mff.cuni.cz/old/archive/asia1997/problemF.html[/url] I need the code..Help me c++ Masters

Member Avatar for Taywin
0
101
Member Avatar for mike42intn

im making this hangman game for a class assignment i was just hoping for some suggestions its a work in progress [CODE]#include "stdafx.h" #include <iostream> #include <iomanip> #include <string> #include <array> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string response; int w; const int WORDS(4); do//outer do loop …

Member Avatar for group256
0
67
Member Avatar for someguyjbb

I have to make a copy constructor for a queue class and decided to use enqueue to put the files in, but for some reason it gives a runtime error. so I really need some help in figuring out what is wrong. Thanks in advanced [CODE] #include <cstddef> #include <string> …

Member Avatar for Ancient Dragon
0
118
Member Avatar for mphan228

Hey guys, I have a soda machine program assignment that requires the user to insert an amount that has to equal to dollars, quarters, dimes, or nickels. Any other input will be displayed in the "Coin Return". The display should loop showing the current amount deposited until the user's deposit …

Member Avatar for mphan228
0
213
Member Avatar for someguyjbb

please help It says when creating the object of ArrayCharQueue that I can't because it is abstract and am not understanding why please help [CODE]//array based charqueue // must use abstract base class char queue // must be dynamically allocated #include "charqueue.h" #include <iostream> #include <cstdlib> class ArrayCharQueue : public …

Member Avatar for mike_2000_17
0
114
Member Avatar for jorgempaz

I'm working in a large program. The problem is that I have to [COLOR="Green"]redraw the screen from time to time[/COLOR]. Go back to draw with SetPixel is too time consuming. With C++ I used putimage and getimage without any problem, but I can't find the equivalent instructions in windows programming …

0
95
Member Avatar for havalka

Hello everybody, I am new to this forum. I got a stuck in my work ... I have ASCII file with numerical values, and I need to read them and save them in a matrix of 2 dimensions?.... If anyone can help me please ....!!??? Looking forward to any help …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for Sohelp

How i can use contractor and destruction function in program? I do not understood about this two function. Please help me ...... Your Regard Sohel Rana Bangladesh

Member Avatar for Stefano Mtangoo
0
60
Member Avatar for hamza123

My question is that what is the effect if I delete a pointer in a linked list by mistake??? What problems will arise and how will I come to know that is a missing pointer that is causing the trouble?

Member Avatar for hamza123
0
98
Member Avatar for Sohelp

Hello All, I can not understood what is function Overloading? Please help me........ Your Regard Sohel Rana Bangladesh

Member Avatar for gerard4143
0
118
Member Avatar for ak_2005

hi! i tried to run the following program in BORLAND C++ version 5.02.. [code] #include<stdio.h> #include<graphics.h> #include<string.h> #include<math.h> #include<conio.h> int const monthcount=12,dataoffset=18; struct indata { float realarray[ 12]; float array[ 12]; }; char getlabel[3]; indata data; int monthplace[ 12]; float interval,chartbottom,radius; struct wcp { float x; float y; } coord[monthcount]; …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for Sohelp

How i can use contractor and destruction function in program? I do not understood about this two function. Please help me ...... Your Regard Sohel Rana Bangladesh

Member Avatar for gerard4143
0
47
Member Avatar for Sohelp

I have a little bit problem,and that is when i use inline function? Another one is advantage and disadvantage of inline function. Anyone help me? Your Regard Sohel Rana Bangladesh

Member Avatar for Sohelp
0
250
Member Avatar for pjmmartins
Member Avatar for Armistice

For some reason im getting stuck in a loop after i enter in my "numberinput" i have a mimic case that does the same thing but with characters instead of numbers, and it seems to work perfectly all this is doing is checking to see how many times the user …

Member Avatar for Armistice
0
155
Member Avatar for lisvonj

I have displayed an array in which I have added numbers in. Numbers 1 through 9, with 9 being a sentinel value. That I cannot figure out how to assign these numbers to the corresponding indicies. Please, please help [CODE] #include <iostream> #include <iomanip> #include <string> #include <fstream> using namespace …

Member Avatar for lisvonj
0
145
Member Avatar for elminster67

hi guys, I have another noob question, I was wondering if anyone can help me with it. the home work assignment I have is "[B]In this assignment we are going to write a phone directory program. The user is asked to input a name and the program looks up the …

Member Avatar for elminster67
0
176
Member Avatar for theashman88

[code=c++] #include <iostream> using namespace std; int getNumChild() { int numChildren = 0; cout <<"How many children do you have? "; cin >> numChildren; return numChildren; } int calCredit(int numChildren, double income) { int totCredit = 0; totCredit = numChildren * 1000; if (income < 70,000) { if (totCredit > …

Member Avatar for theashman88
0
1K
Member Avatar for keskor

Hey guys i want help on implementing operator + (char) this is supposed to add a single element in an array

Member Avatar for Fbody
0
68
Member Avatar for daviddoria

When trying to pass a template parameter to another template, I am getting an 'invalid template parameter' error. I even tried to force it with 'typename' with no success. Can anyone see what's wrong with this? [code] #include <itkImage.h> #include <itkImageFileWriter.h> #include <itkRescaleIntensityImageFilter.h> template <class T> void WriteImage(typename T::Pointer image, …

Member Avatar for Fbody
0
4K
Member Avatar for babylonlion

Hi, This is what the program does: -reads data (stock symbols, open price, closing price, high price, low price, previous price, and volume ) from a text file -do some calculation to produce percent gain/loss for each stock and produce closing assets -produce a list ordered by percent gain/loss and …

Member Avatar for frogboy77
0
2K
Member Avatar for smithag261

I want to know how to write a program to obtain sum of the first and last digit of a number?

Member Avatar for arkoenig
0
233
Member Avatar for Kunal Aggarwal

I wanted to know that when I create a MFC Multiple Document (Application Type) can I use it to make an Application which I can use as a text editor. (Note : I have installed a VC2008 Feature Pack and want to create the Application Office Style) Actually my purpose …

Member Avatar for Ancient Dragon
0
191

The End.