Beginners - April 2013 (Page 50)

Default Arguments
 
Why are these function declarations illegal? void t1(int x, int y = 0, int z); void t2(int x = 0, int y = 0, int z);
[1 reply] : t2(1, 2); Now tell me values of x, y and z; Only trailing arguments... (by MiiNiPaa)
by OSamo
count() for two dimensional arrays.
 
I have come across this reference article on the count function:(http://www.cplusplus.com/reference/algorithm/count/) And while testing it, I could not find how...
[3 replies] Last: I have found that the last code actually works, my mistake was somewhe... (by OSamo)
Pointer to pointer to class
 
Compiler is telling me the address pointed to by pTRI is invalid with the use of -> directive. int main(){ ctriangle* TRI=ctriangle::GetNewTri(); crectangle...
[1 reply] : to_top("pointer_to_pointer_to_class/thread"); (by billywilliam)
Output to two out of three files; Help!
 
So in this assignment we are supposed to read in a bunch of information from "INPUT_DATA.txt" for a publication company. The information is basic stuff like las...
[1 reply] : I'm pretty sure there's something wrong with how I have it checking to... (by theohux)
Using and Initializing Pointers
 
I'm having trouble understanding how pointers work. I tried playing around with them and found some curious results. And based on the theory provided by my book...
[4 replies] Last: Ahh, I appreciate the help a lot! (by anonymousxyz)
execute paramerized constructor
 
//reply fast please..... class abc { int a; public: abc() { } abc(int) { } }; void main() { abc obj ; } //in...
[1 reply] : abc obj = {abc(1), abc(2), /*...*/, abc(10)}; or abc obj = abc(9)... (by MiiNiPaa)
by odai
what is the wrong here ?
 
template<class T> supermarket& supermarket<T>::operator=(supermarket& b) { *name_of_supermarket=*(b.name_of_supermarket); *area=*(b.area); for(...
[6 replies] Last: ok i solved it but what about main !! when i write supermarket<in... (by odai)
checking for palindromes
 
I'm doing an assignment for school where we have to find three palindromes from a file containing a bunch of words. I have the program running, but it only di...
[5 replies] Last: Wow, thanks usandfriends!!!! Contario, I'm actually in San Francisco, ... (by closed account 9Nh5Djzh)
Debug Assertion Failed!
 
I am new to C++ and this forum. When I was working on my assignment, a 'string subscript out of range' error keeps occuring in Line 1441. The partial code is...
[3 replies] Last: Maybe like this, test the string length before accessing its content... (by Chervil)
by chondr
Having problems with functions.
 
Trying to get the square of the numbers 1-100, but not use the square() function. I want to instead use repeated addition in a self made function that will do t...
[1 reply] : for (int p=0; p>x; ++p) p>x will always be false, so the loop does n... (by Chervil)
Easy question.
 
What do you think of this stile of coding with this kind of separation and explanation: #include <iostream> #include <string> using namespace std; /*===...
[1 reply] : I prefer to keep the lines of code no longer than 80 characters, the l... (by Chervil)
by poziga
Reading ceratin type of data from table
 
Hello I am using standard C and have a question. I would like to check if an element from the table equals #. I have the following. char table ; //1000 rows...
[1 reply] : char table ; reserves million bytes from stack and sets name "table... (by keskiverto)
Stuck in vector excercise!
 
This is the math: Use vectors to implement a high score list for a video game. Make it so that scores are updated automatically, and new scores are added into ...
[4 replies] Last: appreciate your help very much! ^_^. now i run just fine, tk (by kradragon94)
by TheRob
problem with successive getline() calls and entering EOF on terminal
 
Please look at the following code, I believe the comments make the problem fairly obvious to understand .. #include <iostream> using namespace std; // fun...
[8 replies] Last: @Aceix Thanks for the reply, but I don't think unwanted characters ar... (by TheRob)
help me to figure out the error pls........
 
#include<iostream.h> char NAME ; int PH_NUM; class customer { char namE ; int ph_number; public: int add_cust() { cout << "enter ur custo...
[1 reply] : Include directive #include <cstdlib> (by vlad from moscow)
Miscalc in find all sum of all mults of 3 and 5 less than 1000
 
My code is giving me the wrong answer for the total sum of :266341 According to online sources the correct answer is :233168. I can't see the problem in my ...
[2 replies] Last: As well as the double counting of 15 and multiples, the output loop st... (by Chervil)
Multiply all smaler numbers than number specified
 
I want to create a program that does this: a = 7 result = 7*6*5*4*3*2*1 // until 0 cout << result Program calculates the result of a*(a-1)*(a-2) --> until 1...
[3 replies] Last: Variable c will always have the value of b * ( b + 1 ). As in your exa... (by vlad from moscow)
by Pebble
TicTacToe Exercise
 
I've done the TacTacToe exercise, And it look' a bit bloated with if staement's. Is there a way i could have done it with i.e. for loop's ? Open to any crit...
[3 replies] Last: Thank's for your comment's. Found an error in the win check at line 12... (by Pebble)
Help! Investment program
 
Write a program that finds how many years it takes for the value of Cleo’s investment to exceed the value of Daphne’s investment and then displays the valu...
[no replies]
Global variable of own type
 
Ok, I hope I'll explain my problem clearly :D. I need to define global variable of my own type, but I don't know where. I am making some Windows Form App in MC...
[3 replies] Last: Yes, I have had #include "define.h" both in Form1.h and my_project.cpp... (by Hans999)
April 2013 Pages: 1... 4849505152... 83
  Archived months: [mar2013] [may2013]

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