49,761 Topics
| |
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 … | |
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 … | |
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 … | |
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 ) … | |
a. degree fahrenheit to celsius and vice versa b. centimeter to feet and inches to feet | |
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 … | |
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 … | |
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. | |
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 … | |
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 … | |
hey there i am trying to make quadratic equation problem solver. | |
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. | |
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 … | |
(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 … | |
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? | |
I am new to C++. Can somebody help me in this problem how can i evaluate and print the largest number from a series? | |
#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` | |
#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; } | |
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 … | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
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) | |
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 … | |
"URGENT" Structure or design(how many and what kind of classes may be involved) of "Automobile Dealer shop" project | |
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 … | |
Hi everyone, First time here, my early days in c++, will really like to be mentored(the experts) |
The End.