Beginners - October 2014 (Page 65)

clarification for understanding new and delete
 
Would anyone mind just checking my code to see if there are any memory leaks? I have been learning about new and delete and am very interested in using thos...
[8 replies] Last: Also, thanks @anup30 for the alternative. (by bryan177mcsc)
by iluv41
private member error
 
I am getting the errors , add.miles, add.yards, add.feet, and add.inches in the '+' operator overload, but I do not understand why i am getting this error on th...
[5 replies] Last: Odd how one works and the other doesn't. The only thing I could point ... (by TheKingOfTyrants)
by Nebur
What is this program failing in?
 
I use a divide an conquer aproach to solve the followoing problem: Given a 2x2 matrix of integers M, and two integers n and m, compute (M^n)%m. The automa...
[no replies]
Program 19
 
Hello, I decided to move on with my exercises, Keep track of the sum of values entered (as well as the smallest and the largest) and the number of values en...
[no replies]
Why segmentation fault (core dump)?
 
I've written the following code for http://uva.onlinejudge.org/external/114/11466.html When i give 1234567 as input it shows segmentation fault (core dump).....
[1 reply] : Segmentation fault is a memory error which means you've gone beyond th... (by TheKingOfTyrants)
While Statement inputs the last input
 
Alright, so this is pretty self explanatory, but the while statement in my program is using the last input whenever there is a cin which then puts the program i...
[2 replies] Last: THANK YOU SO MUCH! I would have never found that! (by Zephrman)
reading from a file into a struct
 
I am trying to read some data into a struct from a file, but I keep getting an error for infile >> whInventory .itemName; The data I'm reading is a file fille...
[4 replies] Last: Something strikes as odd in this code fragment: infile >> whInvento... (by megatron 0)
Timers related question
 
Hello everyone. Quite straightforward: which function can I use to make a program count (in seconds, milliseconds or whatever) how much time a keyboard's key...
[2 replies] Last: Thank you very much for trying, but I already knew of sleep function a... (by Metronom)
Starting a program from C++
 
Hello How do I start a program from C++? It's a Python script by the way. It should be working on Linux and Windows. Without using a system-function. ...
[1 reply] : On Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/bb... (by MiiNiPaa)
comprehension problem using c string arrays
 
Hello everybody, I'm new in c++ and don't know much about using pointers. What I actually know is how to declare a pointer like this: char var = 'a'; ...
[9 replies] Last: are pointers the same thing as arrays and arrays are pointers?? No. ... (by MiiNiPaa)
C++ primer exercise 2.4.2
 
Please help ? Exercise 2.27 - Which of the following initializations are legal? Explain why. a) int i = -1, &r = 0; b) int *const p2 = &i2; c) const int ...
[no replies]
assigning variables to an array of objects?
 
I have tried a couple different ways of assigning variables to this array. When I do it this way I get an error on the payroll = h; that says "No viable over...
[3 replies] Last: Thank you! (by adam0421)
by NOD32
I need help passing values by reference (functions)
 
I absolutely suck at functions. I know that you need to declare a function, code for it outside main, and then call it in main. I just don't know the syntax wel...
[5 replies] Last: gibllit: You are right, of course - I have been out of the C/C++ mode... (by PCrumley48)
Time input to int
 
Hello, I just recently started taking a C++ class so I apologize if this question is too obvious for some. I'm working on an assignment that asks to take the...
[2 replies] Last: Awesome, thank you. I had a feeling it had to be done with a string, ... (by druid84)
by davez
finishing the atm
 
i have some problem concerning the withdraw part how can i prompt the user that the withdrawn amount is invalid if he/she entered amount that has a decimal. ...
[2 replies] Last: nevermind i was already able to solve it (by davez)
Blog for newbs
 
Hi, I've been writing a blog called Adventures of a Wannabe Programmer, and would love to have any feedback or suggestions of what to post. My latest blog is o...
[no replies]
Visibility of globally defined Vectors in Subfunctions
 
Can anyone see the mistake? I am generating a vector<vector<bool> > in an global namespace. Subfunctions of Main() are accessing this vector. Compiling makes n...
[3 replies] Last: //Accessing data bool access_vector(int x, int y) { /// first=pat... (by anup30)
Difference between Capacity and Size of an Array
 
Hello I just wanted yo know the differece between the capacity and the size of an array. Here is how my question starts and I need to know the difference, to...
[8 replies] Last: capacity to hold N Foos reserve(N) reserves for N+i elements //i>=0... (by anup30)
by msrt92
parameter constructor
 
output is not corrector its something like this Name:___________Azzz Natinality:_______Azzz #include<iostream.h> class Citizen{ private: char *na...
[4 replies] Last: All of these three constructors are meant to initialize their respecti... (by msrt92)
passing a char array to struct char
 
I cant seem to copy a char array to a struct variable.. struct name { char first_name ; } struct name e; char string = "copy me"; strcpy...
[2 replies] Last: #include <iostream> #include <cstring> // did you forget it? using na... (by anup30)
October 2014 Pages: 1... 6364656667... 70
  Archived months: [sep2014] [nov2014]

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