49,761 Topics

Member Avatar for
Member Avatar for Sarkurd

Hi I wrote a Singleton class but i got an error while controlling instantiation captain.h #ifndef CAPTAIN_H #define CAPTAIN_H #include <iostream> #include <string> class Captain { private: Captain(); Captain(const Captain&); Captain &operator=(const Captain&); std::string name; public: //Controll Instantiation static Captain &GetInstance(); //Set Name of the Captain std::string GetName(); //Get his/her …

Member Avatar for Sarkurd
0
188
Member Avatar for nhrnjic6

Am trying to build a function that will take string, sub_string that will be replaced, and new string that will replace that sub_string. Now before you all go with strstr, i dont want to use <string>. Anyway I got my code working to find a index of a char array …

Member Avatar for vijayan121
0
220
Member Avatar for whitebloodcell

I have a large database of tennis match reords played in the ATP and WTA tours over several years. I am going through these to generate a match history for each player in each year in each tour. I have 5 years of data and 4 tours (hence the dimensions …

Member Avatar for mike_2000_17
0
297
Member Avatar for lewashby

In the program below what is the difference between rand and srand? My book says that rand returns an int between 0 and RAND_MAX, which is never smaller than 32,767. Yet this code returns a number from 1-6, how is that? I see the line `( rand() % 6 ) …

Member Avatar for deceptikon
0
214
Member Avatar for tentrabyte

a. degree fahrenheit to celsius and vice versa b. centimeter to feet and inches to feet

Member Avatar for Moschops
-2
239
Member Avatar for Ivzirnalsradeys

A large program has been written for a company which rents out properties to tenants for long or short periods. There are separate data files which hold information about A the tenants B the properties C the payments made by tenants D the payments made by the company for the …

Member Avatar for David W
0
186
Member Avatar for tentrabyte

Make a C++ program that will ask for integer value and assign that integer value to variable A. Declare another floating point data type variable and name it as B with a constant value of 95.4567. Display the value of B variable in integer format and another display of B …

Member Avatar for David W
0
135
Member Avatar for tentrabyte

Write a program that will ask for two integer numbers. Assign the first integer to the first operand and assign the second integer to the second operand. Declare a variable named SUM. Get the sum of the numbers and assign it to the SUM variable.

Member Avatar for David W
0
110
Member Avatar for HuePig

Hi, I have a class named 'roomOne' and another named 'StoneAdventure'. 'roomOne' inherits from 'StoneAdventure'. Heres the Problem: Whenever I create an #include "roomOne.h" in the header file of 'StoneAdventure' I get an error C2504: base class is undefined. Note: Everything works fine if I remove the #include "roomOne.h" from …

Member Avatar for HuePig
0
202
Member Avatar for Tycellent

Hey everyone, Just trying to add to a scoreboard from a different class. The problem is that i'm not sure how to add to a scoreboard that has been previously defined in a different class. As i've instantiatied i'm assuming that has made a whole new Game (with a new …

Member Avatar for tinstaafl
0
879
Member Avatar for micheletsigab
Member Avatar for Hiroshe
0
105
Member Avatar for MasterChat

Good day to all! I'm totally lost here. I am just beginning programming lessons by reading How to Design Programs and use Dr. Racket. I bump into C++ and got confused which one should I learn first. Or should I study them at the same time. Please advise.

Member Avatar for MasterChat
0
218
Member Avatar for furalise

Hi Everybody. Was hoping someone could clear this up for me. My understanding is not good in this area. The below code simply reads a string from a text file two characters at a time. It then outputs them to console then casts them to an int and then outputs …

Member Avatar for Moschops
0
225
Member Avatar for Mark Kim Bryan

(The power station problem) A power station is on one side of a river that is one-half mile wide, and a factory is eight miles downstream on the other side of the river (see Figure 7-21). It costs $7 per foot to run power lines over land and $9 per …

Member Avatar for Schol-R-LEA
0
356
Member Avatar for iqra aslam

hello, i have dev c++ software , when i compile my program it displays an error message showing that "g++ =.exe has stopped working", what is the issue?, how can i resolve this issue?

Member Avatar for Schol-R-LEA
0
67
Member Avatar for faisaljvd

I am new to C++. Can somebody help me in this problem how can i evaluate and print the largest number from a series?

Member Avatar for faultybits
0
110
Member Avatar for Erick02

#include<stdio.h> #include<conio.h> void main() { int i,n,j; clrscr(); printf("\n Please Give The Value of N: "); scanf("%d",&n); for(i=n;i>=1;i--) { for(j=i;j>=1;j--) printf("%d ",j); printf("\n"); } getch(); system ("pause"); return 0; } `Inline Code Example Here`

Member Avatar for faultybits
0
436
Member Avatar for Erick02

#include <stdio.h> #include <conio.h> #include<math.h> void main() { int n,i,j,m,k; clrscr(); printf("Enter the No :- "); scanf("%d",&n); m=n; for(i=1;i<=n;i++) { printf("\n"); for(k=1;k<=2*m-1;k++) { printf(" "); } for(j=1;j<=i;j++) { printf(" *"); } m--; } getch(); system("pause"); return 0; }

Member Avatar for Slavi
0
74
Member Avatar for MrSONOFAHIPPY

Please help. I have an programming assignment due and i can't figure out how to code it. Complete the following code so that the program: 1. reads in any number of values in a given range into an array of integers 2. counts the frequency of each value, storing the …

Member Avatar for Erick02
-1
1K
Member Avatar for muhammad.husnain.5099
Member Avatar for andrew mendonca

Define a function named isDivisor that has two parameters of type int and returns a value of type bool. A call to isDivisor(m,n) should return true if and only if (iff) m divides n. For example isDivisor(6,24) will return true but isDivisor(5,24) will return false . Note that every number …

Member Avatar for chriswelborn
0
319
Member Avatar for andrew mendonca

Define a function int getRoots(double a, double b, double c, double & s1, double & s2) that solves a quadatic equation with coefficients a, b and c. If there are no real roots than the return value will be 0 and the values of s1 and s2 will be left …

0
130
Member Avatar for andrew mendonca

Define a function void order(int & a, int & b, int & c, bool ascending) that places the values in ascending or descending order, depending on whether the last parameter is true or false . For example, if x, y and z contain the values 3,1, and 2, respectively, then …

Member Avatar for ryantroop
0
224
Member Avatar for tentrabyte

A data that will declare the following variables with the corresponding data types and initialization value. Output the variables names together with the values. **Variables** **Data types initial value** Letter character a pi float 3.14 Name character sam

Member Avatar for chriswelborn
0
119
Member Avatar for CairBear1

I have to use inheriantce and polymorphism to calculate the force required to pull (at a constant velocity) and the weight of material that can be carried by a train consisting of many different types of cars. The weight ( *W* ) and rolling friction coefficient (f) can be used …

Member Avatar for Hiroshe
0
190
Member Avatar for justugas

Hello, I will make a program with c++ about binary tree, how to implement this structure tree to C++ [Click Here](http://1.bp.blogspot.com/-LyRoy4Vg5D4/UzFIproOq5I/AAAAAAAAAe4/UapVUA_7ZPA/s1600/tree.jpg)

Member Avatar for deceptikon
0
236
Member Avatar for andrew mendonca

Define a function bool isWin(char board[][3], char target); that returns true if character target has a winning position on this tic-tac-toe board. That means three occurences of target in a line, column or along either diagonal. For example if target is 'O' and if board[0][2], board[1][1] and board[2][0] all equal …

Member Avatar for Moschops
0
285
Member Avatar for sakshu

"URGENT" Structure or design(how many and what kind of classes may be involved) of "Automobile Dealer shop" project

Member Avatar for rubberman
0
52
Member Avatar for Mr.M

Hi Dw I know this may not be popular to many people but it a standard for financial industry. I'm developing a WOSA XFS app, I've developed the part that deals with calculating denominations, determines how many CU can be dispensed for each CU denomination. Now the problem is that …

Member Avatar for Mr.M
0
2K
Member Avatar for yeyo_1

Hi everyone, First time here, my early days in c++, will really like to be mentored(the experts)

Member Avatar for yeyo_1
0
156

The End.