Beginners - February 2014 (Page 54)

by alsade
compiles but not working...help plz!!
 
this program compilation succeeded but it doesnt work. i guess it has something to do with the assignment operator or the copy constructor but i cant figure ou...
[3 replies] Last: Other than the fact that you assign to the object that is supposed to ... (by cire)
Problem
 
#include <iostream> #pragma hdrstop using namespace std; int fun(int x){ return x*x; } int main () { int n , i , x, t; x = 0; t = 0; n = 75; for (i=...
[7 replies] Last: I need to find out all highest square values from 75 to 0. And I have... (by mutexe)
my set value member function set data member values but the get function return default values
 
why does my get function return the default member values and not the values my set function set data member values to? // comp.h #ifndef COMP_H #...
[1 reply] : Should you be calling cset.setaddcompnum instead on line 96? Edit: ... (by kevinkjt2000)
Logic Error
 
I have created a program that creates a loan amortization table. It works but there is some problem in the logic that is causing it to miscalculate the interest...
[1 reply] : ((12.035 / 12 * 880) + (0.035 / 12 * 120)) This formula gave me the co... (by kevinkjt2000)
by AmitH
Ampersand in String
 
Hello everybody, Until now, I thought that ampersand (&) is used to display the memory address. For example: int a = { 1, 2, 3 }; cout << &a << endl; ...
[4 replies] Last: Let's phrase it so: The stream (cout) 'knows' what a string is and pri... (by coder777)
I'm not getting dowhile loops
 
Write your question here. #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main() { int nLoopCount; cout ...
[4 replies] Last: Thank you all so much! Sorry, my condition that i think you were all h... (by cplusone)
Why can't my derived class use a setter inherited from the abstract base class to change the value of a private member?
 
I have a public derived class called Rectangle and I'm trying to have a virtual function in Rectangle called calcArea() use the setter function called setArea()...
[8 replies] Last: You're welcome :) (by MikeyBoy)
by alsade
how to initialize array of objects during declaration?
 
i created a class : header: class employee{ char name ; unsigned int salary; public: employee(); employee(const char*,unsigned int); void init(c...
[1 reply] : #include <iostream> struct X { X( int i, char c ) : i( i ), c( c... (by nvrmnd)
Confusion about function call syntax
 
I am using this tutorial for SDL: http://lazyfoo.net/tutorials/SDL/04_key_presses/index.php. I am reading through the provided source code for it and there is a...
[4 replies] Last: So when it evaluates if init() returns false it also calls init() at ... (by MikeyBoy)
copying data in arrays
 
I have to copy data from locations of one array in to another array, for that i am calling function below, there are errors template <std::size_t size_sour...
[2 replies] Last: thanks (by amitk3553)
difference in dates
 
How do I calculate the difference in date? e.g 8/31/2110 - 2/27/1977 = 48762 1) number_of_days(int month, int day) // return the nth number of days...
[no replies]
Out-of-bounds access (ARRAY_VS_SINGLETON)
 
Need little help.. #include <iostream> int main() { int bit = 1; int init = 0xf ^ (1 << bit); char* c = new char(2); sprintf(c, "%x", init); std::...
[2 replies] Last: Somebody told me this and I am agree with this alternative.. You cann... (by bhargavah)
Resource leak..
 
#include<iostream> int* func_b() { int *c = new int; return c; } int main() { int* b = func_b(); return 0; } I can see that memory leak would be ...
[4 replies] Last: Also FWIW, there is no need for dynamic allocation in this example. f... (by Disch)
by jwilt
array filling
 
How do I store "46123" into an array that holds up to 30 digits? with the numbers going into the array like this: 0 1 2 ...... 25 26 27 28 29 (array s...
[7 replies] Last: the input file has strings of numbers but I think I can make it work w... (by jwilt)
can't figure out why i'm getting a segmentation fault error
 
while(fin >> inCode) { if(i < 1000) { if(inCode == 9999) { array = inCode; i = 999; ...
[1 reply] : Because you are probably accessing out of bounds on your array. If you... (by firedraco)
Bank account program while loop error
 
I need to add the ending balance to the new balance for 12 months with a desired interest rate using a loop then print it to the screen sort of like this ...
[no replies]
Can't get this loop working!
 
***I got the functions working, but the loop still isn't. Is there a type of loop that will terminate as soon as the user tells it to instead of executing one m...
[3 replies] Last: Can't believe I missed that with operator precedence... I got the func... (by chandeliho)
Need help with using arrays and vectors in functions
 
Hi, I need to put some equation into array(located inside function). This equation was made inside class (with method) and passed to vector. The equation is fur...
[3 replies] Last: Ok, so I put the whole thing under one main function and now it can be... (by ezechiel)
by Chubby
expected unqualified-id error
 
int main () { int first ; read_array (first,SIZE); } void array (int read , int size1) { srand( (unsigned int) time(NULL)); for (int i=0 ; ...
[7 replies] Last: This isn't really the type of place to be asking these types of questi... (by Computergeek01)
by GGG
Simple text editing program
 
I got a little bit of trouble creating a program that edits text in C++. Keep in mind that I'm still at the beginning of programing. Here is what I must do: ...
[3 replies] Last: ... but I'm really curious why it doesn't work like that. Because o... (by Computergeek01)
February 2014 Pages: 1... 5253545556... 60
  Archived months: [jan2014] [mar2014]

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