49,757 Topics
| |
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: … | |
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", … | |
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 … | |
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++) … | |
#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 … | |
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 … | |
#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(); } | |
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 … | |
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 … | |
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 … | |
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 … | |
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 () … | |
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 … | |
#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] = … | |
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 … | |
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 … | |
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 … | |
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]; … | |
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: ( … | |
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() … | |
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; … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. | |
What output is generated from the following code: cout << 2 * (5.0/2) << endl; |
The End.