49,757 Topics

Member Avatar for
Member Avatar for sarah.mathieson.7

This is the prototype I was provided with for my Person constructor: Person(const char * their_name, const char * email, int day, int month, int year); In making my constructor I have tried to use base member intialization, but I am having issues, this is what my constructor looks like: …

Member Avatar for mike_2000_17
0
261
Member Avatar for toneranger

Hi All, Well I've been stuck for a while here. I'm trying tp write a function called TransfertoSwingID which will transfer a line of data held in a struct contained in a vector to a new vector of structs. Basically as I'm iterating through the vector of structs called "prices", …

Member Avatar for tinstaafl
0
176
Member Avatar for can-mohan

Hi All, I have doubt in my mind regarding declaration of cin and cout object . As per my understanding cin and cout both object are accessible in main then they shouldn't have protected.in below code snippet i have overloaded both input and output operator and while giving new name …

Member Avatar for can-mohan
0
455
Member Avatar for PulsarScript

Hi to all,can anyone tell me please why is the code doesn't behave as it should. It dispalys hours and minutes from 19:00-23:59 ,but not from 00:00-23:59? Here is the code. #include "stdafx.h" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int hours ,minutes ; for(hours =0; hours<24; hours++) …

Member Avatar for deceptikon
0
94
Member Avatar for H_beginner

#ifndef POINT_H #define POINT_H class Point { public: Point(); Point(int, int); int getx(); int gety(); void setx(int); void sety(int); private: int x,y; }; #endif //POINT.CPP #ifndef POINT_H #define POINT_H class Point { public: Point(); Point(int, int); int getx(); int gety(); void setx(int); void sety(int); private: int x,y; }; #endif #ifndef …

Member Avatar for H_beginner
0
416
Member Avatar for glao

Hello , I am trying to solve some problems from the "Computer Simulation Methods" book. It says > > Write a class that solves the nuclear decay problem.Input the decay constant l from the control window.For l=1 and dt=0.01 ,compute the difference between the analytical result and the result of …

Member Avatar for glao
0
641
Member Avatar for prakhar_1

#include<iostream.h> #include<conio.h> void main() { int a[10],i,item,flag=-1; cout<<"enter the elements of an array"; for(i=0;i<=9;i++) cin>>a[i]; cout<<"enter the element to be search"; cin>>item; for(i=0;i<=9;i++) if(item==a[i]) { flag=1; break; } if(flag==-1) cout<<"search unsucessfull"; else { cout<<"search sucessfull"; } getch(); }

Member Avatar for NathanOliver
0
155
Member Avatar for suhasgh

Evil Nation A is angry and plans to launch N guided-missiles at the peaceful Nation B in an attempt to wipe out all of Nation B’s people. Nation A’s missile i will arrive in nation B at the time ti. Missile i communicates with its headquarters by unique radio signals …

Member Avatar for nerandell
-1
267
Member Avatar for fiffa

Write a C++ program that defines class Student with data members: ID, Name, average and array of 5 integer grades. And member Functions: - A private function computeAverage: to compute student’s average( the data member). - A public function getAverage that returns the value of student’s average - Overload the …

Member Avatar for Ancient Dragon
0
100
Member Avatar for toneranger

Hi, I've got a vector of structs populated with the following fields: double double double double (unsigned int) (unsigned int) string I want to take each line in that vector (call it OldVec), and 1. transfer it to a new vector of structures 2. add a string identifier at the …

Member Avatar for toneranger
0
270
Member Avatar for jvasher

Sometime crashes, sometimes blank text, and sometimes works. I'm passing (I hope) a reference to TextDisplay::update() so It can draw all the text in keyBindMenu which is a vector of std::strings. I'm not sure if I'm handling this correctly. My understanding of this is very weak, but I think I …

Member Avatar for jvasher
0
132
Member Avatar for refphlex

The second loop after opening the file again the second calculation for count isn't coming out correctly it seems to be doubled, comes out double the normal value when it shouldn't someone help please! #include <iostream> #include <iomanip> #include <string> #include <fstream> #include <cmath> using namespace std; int main () …

Member Avatar for refphlex
0
166
Member Avatar for nathan.pavlovsky

Hello programmers! I am working on a Tic-Tac-Toe player vs. computer class, which is supposed to have a `run.()` method in order for the game to start. In a `gameWon()` member function, I am checking for a win, either by the player or by the computer. I check to see …

Member Avatar for Moschops
0
512
Member Avatar for vdhyasri

#include <stdio.h> #define N 40 void sum(int*p, int n, int d[]) { int i; *p = 0; for(i = 0; i < n; ++i) *p = *p + d[i]; } int main() { int i; int accum = 0; int data[N]; for(i = 0; i < N; ++i) data[i] = …

Member Avatar for mike_2000_17
0
174
Member Avatar for roidbeginnerlvl

I am trying to read a textfile containing some informations in this format, itemId:itemDescription:itemCategory:itemSubCategory:amountPerUnit:quantity:date. item.txt 1:macbook:electronics:laptop:100:100:18-Oct-13 2:Iphone 5:electronics:handphone:50:50:18-Oct-13 I am able to extract everything except the itemId. Please advise or suggest what I should change/do to get the id. Thanks in advance. my output Id: <----blank! Item Description: macbook item …

Member Avatar for richieking
0
200
Member Avatar for jvasher

Tried searching for an answer to this, but not sure even how to explain this question so i will show a code example.(I blame java, better then saying i'm brain damaged) I have no problems with pointers. But can't seem to remember the correct way to call the constructor when …

Member Avatar for deceptikon
0
289
Member Avatar for nyfan68

I was wondering if anyone could assist me with an assignment. The problem deals with operator overloading. In this assignment I have to modify a class called "Complex" to a)enable input and output of complex numbers via overloaded>> and << operators b)overload the multiplication operator to enable multiplication of two …

Member Avatar for angel.ey.7503
0
493
Member Avatar for furalise

Hi What is the difference between using the **fstream** library to read a file....and using something like a procedure below using the FILE* object? There seems to be two ways to read a file? Thanks /* FEOF example */ #include <stdio.h> int main() { FILE * pFile; char buffer [100]; …

Member Avatar for furalise
0
823
Member Avatar for andrew mendonca

Here is the website for the assignment I am working on: http://view.samurajdata.se/rsc/5c1dd0b4/ Here is the website for my header file (MixedExpression.h): http://ideone.com/G9aC9D Here is the website for my library source file (MixedExpression.cpp): http://ideone.com/PfH8f0 Here is the website for my calculator client file (Calculator.cpp): http://ideone.com/4wGayu Here are the input lines: ( …

Member Avatar for Banfa
0
215
Member Avatar for nhrnjic6

I have a practise problem to write a function that takes 3 dim and dynamicly allocates 3d array with those values and then (PART THAT I DONT GET) : fills the 3-dimensional array with multiplication tables. What am I even supossed to do ?? Here's my code : int main() …

Member Avatar for tinstaafl
0
168
Member Avatar for SpottyBlue

I am kind of new creating the A1Z26 cipher generator. But this has a problem. Only the program generates the last two numbers. What's wrong? #include <iostream> #include <ostream> #include <string> using namespace std; int i; // Counter char str1[101]; // A string of characters for generator. string str2, str3; …

Member Avatar for tinstaafl
0
2K
Member Avatar for mixelplik

How can I loop through a data field with a binary search, looking for multiple values? Please, I don't want to know another, more efficient way, I want to do it this way to understand the concepts. Also my data is indeed sorted before the call is made. The data …

Member Avatar for mixelplik
0
1K
Member Avatar for skyyadav

implement a generic fn mapf with prototype template<class Sequence c , class UnaryFunction) Sequence mapf(Sequence c , UnaryFunction f) for ex if c is a seq containing the seq (3,2,7,6,8) and f is the fn that returns twice it integer agument. then container returned by mafc(c,f) is a list containing …

Member Avatar for mike_2000_17
0
355
Member Avatar for Andy_3

Write a C++ program that calculates the balance of a savings account at the end of a month period. The program should read from a file (bank.dat, downloadable from blackboard) the account number, the current balance and the account type. Depending on the account type, a different annual interest rate …

Member Avatar for Moschops
0
207
Member Avatar for intelharsh

Hello people, I am using zbar library to detect barcode. I am able to compile and run their sample code in main.cpp Now if I make a class and include <zbar.h> in the header of that class, I get the following error : /usr/local/include/zbar/Exception.h:144: error: the default argument for parameter …

Member Avatar for intelharsh
0
595
Member Avatar for PulsarScript

Can you give an idea how to create this pattern:7. Write a program to display the following pattern x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x …

Member Avatar for Learner010
0
162
Member Avatar for deceptikon

A common task in C or C++ is to get a string from somewhere and convert it to an integer. "Use `atoi`" is a common suggestion from the unwashed masses, and on the surface it works like a charm: #include <stdio.h> #include <stdlib.h> long long square(int value) { return value …

Member Avatar for mike_2000_17
6
2K
Member Avatar for princess.ferolino.1

can you help me how to display an equivalent color once an input letter matches its first character for example b is for blue, r for red and so on. letter colors b or B blue r or R red g or G Green y or Y yellow other Letter …

Member Avatar for cambalinho
0
240
Member Avatar for kdevesh

How do i reset the existing password in cpp and need that new password for starting the program everytime i start the program?? Please help.

Member Avatar for cambalinho
0
228
Member Avatar for Shabazz120

What output is generated from the following code: cout << 2 * (5.0/2) << endl;

Member Avatar for cambalinho
0
79

The End.