Beginners - September 2014 (Page 20)

by rezora
Problems with constructors and destructors
 
Hi I'm having trouble with this program I am trying to create, I was giving a set of code for int main, but I am suppose to create a class with constructors and...
[no replies]
by Ch1156
Inheritance help
 
So I am doing some inheritance but whenever I try it I always never really see the point as I can just put the stuff in the base class instead of the child clas...
[4 replies] Last: In your case your elf class is not needed. You would be better with ad... (by MiiNiPaa)
Help with functions and structures
 
Hello guys, i'm seeking help again here. I've been trying to practice structures and functions altogether but i don't know why the code is wrong. Can you tel...
[2 replies] Last: Thanks, i can't believe i'm so stupid :P Again, thank you, problem so... (by Fedelway)
Can anyone help me with this?
 
The code Below works just fine.. it will print all combinations from number 1 to 25, in and array of 15 numbers. The thing is, I need to make it print only the...
[2 replies] Last: thanks! (by gabsacr)
Simulation - Running Total
 
I am writing a simulation program and everything works fine except the running total. The simulation loop: for (int sim = 0; sim < SIMS; sim++) { ...
[1 reply] : OK, I just realized my cout << totalCost; was in a very bad place.... (by jdwright)
Output C++
 
Output of the program : //INPUT VALUE OF A =0 int a,b=3; cin>>a; if(a) b=a++ -1; cout<<a<<endl; cout<<b<<endl; ANSWER IS : a=0 b=3 pl...
[2 replies] Last: thanks a lot :) appreciate it ..it helps (by Naman29)
by LuckyR
Misunderstanding the code I've written and it's generated output
 
Hi guys, this will probably be a simple question and solution, but I'm not grasping it at the moment. I'm executing the following code below, with the inten...
[3 replies] Last: yup 0==0 -> true 1==0 -> false 2==0 -> false (by garylee)
Anything above
 
Hello, I am currently working with a project and I am stuck. I'll give an example so you guys understand. Let's say I have 3 variabels, X, Y and Z. I...
[2 replies] Last: Thank you so much! :D (by BlankSpace)
by aLx450
output a _getche() value using toupper
 
Hello all, I'm building a very simple calculator program for currency exchange rates where the user selects, with the press of a letter from a list of choice...
[4 replies] Last: Yes, you can. I see you already using conio.h. In future: do not do th... (by MiiNiPaa)
by BC300
Exception Program with Classes
 
I'm having trouble with understanding how classes are used with exceptions. Since I'm working with classes, do I still have to work with public/private and then...
[6 replies] Last: C++ also comes with a few standard exceptions (runtime_error, logic_er... (by JayhawkZombie)
by Putler
size_t vs size_type and ptrdiff_t vs difference_type
 
Are there any differences between these types?
[1 reply] : size_type and difference_type are class member types which gives i... (by MiiNiPaa)
Compound interest function
 
Hello guys! I am writing a function that calculates a compound interest. It takes 3 parameters. But I have some problem: "term does not evaluate to a fun...
[16 replies] Last: Ah well, as long as it works. I suspect you need to make sure all data... (by closed account 48T7M4Gy)
(C++) 4^20 problem
 
Hey guys, I'm a total newbie and I suck at programming. I have following problem: For CompSci. class we have to create a prog which can calculate power 20 o...
[6 replies] Last: Thank you very, much now I get it. I managed to get correct, uncut res... (by anndurill)
by mtmsl
Sequentially Outputting Elements Of An Array
 
I've been working on an example from a book, which says to do the following: Write a C++/CLI program that creates an array with a random number of elements o...
[2 replies] Last: Yes, there seems to be a flaw in your algorithm. I believe your code f... (by squished18)
by EvE12
Arrow member selection
 
Just wanted to ask if arrow member selection operator is used to access a pointer from any function or its only used to access pointers from classes only?
[2 replies] Last: thanks (by EvE12)
what happens internally in the below function call
 
Hi all, int func(int&a,int&b) { //some statements } int main() { int a=10,b=20; func(a,b); //what happens intrnally in the memory during t...
[3 replies] Last: As I said, that depends on the optimizations the compiler may perform.... (by helios)
Displaying relevant values from an array
 
My task is to create a program that allows the user to input int values. It will then count the occurrence of each digit (i.e. how many 0's, 1's, etc.) in the s...
[1 reply] : Why are you checking ary but outputting values from intCount ?... (by MiiNiPaa)
Why isn't it giving the factorial properly.
 
Write your question here. #include <iostream> using namespace std; long fact(int n) { if (n<0) return 0; int f(1); while ...
[1 reply] : 1) while (n>0, f<n) is equivalent to while (f<n) 2) you are multi... (by MiiNiPaa)
why a macro defined as member function cant access the private data.
 
Hi All, why a macro defined as member function cant access the private data. class A { int x; public: #define func(x,y) x=y; //why error }
[2 replies] Last: Macros are expanded before compilation starts so they doesn't care abo... (by Peter87)
Operators, Variables, Objects
 
I'm just beginning to learn C++, and in the book I'm using as a guide, it asks me--as an exercise-- to modify the code that I've been working with to multiply a...
[4 replies] Last: Well done. The point about putting it on the right line is the machin... (by closed account 48T7M4Gy)
September 2014 Pages: 1... 1819202122... 51
  Archived months: [aug2014] [oct2014]

This is an archived page. To post a new message, go to the current page.