Beginners - March 2015 (Page 27)

by c4l
Least possible money needed for buying grain
 
Hey guys, I need to write a program that would find the least possible money spent for buying grain, if you know the amount of providers, the grain you need and...
[1 reply] : You have: bot = 0; // assign price to p , assuming that 0 < price if ... (by keskiverto)
why isn't this rounding properly?
 
see comments in code. u can see when 55.5000 is calculated, it rounds to 55. Then i assign the value manually to 55.5000, and it rounds properly to 56. ...
[4 replies] Last: ok, read some of it. From what I can understand numbers like .1 can't... (by bob13bob)
Help with while loops (repetition structures)
 
I'm not understanding why I'm getting so many errors. Is there a simpler way I can code this? The payroll manager at Kenton Incorporated wants a program that a...
[3 replies] Last: You would want a do-while loop. Not a while loop. Put all of this code... (by TarikNeaj)
Read only variable is not assignable
 
I've been researching and I'm still puzzled on how this error (Read only variable is not assignable) works. I'm trying to increment a private pointer and derefe...
[2 replies] Last: @Tarik, I figured it was the const! Thanks :) (by decoy98)
String exercise
 
Hello, I need to write a function char* strdup(const char* p) that copies a c-style string into memery it allocates on the free store. I`m not sure how to sta...
[1 reply] : http://linux.die.net/man/3/strdup #include <iostream> #include <str... (by shadowCODE)
by gingy
Is There An Equivalent to the Not Equal Operator for Switch Statements?
 
My question is one I think is possibly a simple one. Is there a way to have a case in a switch statement for the variable NOT being equal to a specific value. F...
[4 replies] Last: If you wanted to be specific, you could use an if statement. For exam... (by closed account 2LzbRXSz)
error C2059: syntax error : 'return'
 
Hey guys, I'm relatively new to c++ , and I'm having trouble with my program I'm writing. It's supposed to ask user input for squares and rectangles, but it's n...
[3 replies] Last: Glad it worked out :) (by TarikNeaj)
Problem with file data manipulation.
 
I'm trying to create a program that opens a .txt document with weight in kilograms separated by a white space and converts it to pounds which then displays it t...
[15 replies] Last: for (int i = 0; i < 5; i++) as file can be variable length, use w... (by anup30)
by SCB3
need some help with an array
 
uiu
[11 replies] Last: thank you, its all displaying perfectly now :) (by SCB3)
how to use while loop
 
Write your question here. when T1>T2 it works. but when T2>T1 it goes to infinity. thanks for help! #include <iostream> using namespace std; int...
[2 replies] Last: You're welcome. (by TarikNeaj)
best way to stream to file
 
Hallo, I am new to C++. I have only experience with C#. I have the below problem: in a loop i receive a buffer and I want so vae it (stream it??) to file. ...
[4 replies] Last: i did read your post carefully. what did you think i linked to? a bunc... (by Little Bobby Tables)
Rock, Paper, Scissors switch statement
 
So, i'm new to all this stuff and not used to c++ yet. My problem here is that when i enter 0-2 it works perfectly fine but when i put in anything greater than ...
[3 replies] Last: http://www.cplusplus.com/articles/jEywvCM9/ (by TarikNeaj)
by Ganado
Non-virtual Inheritance overhead question
 
I have this example question about inheritance. Let's say I have two classes with partial common functionality. Note that they are actually have more differenc...
[2 replies] Last: Great thanks, that's what I assumed as far as speed goes, and it's eve... (by Ganado)
by Rob k
How to compile program in Emacs
 
Hi guys, Struggling a little here, I have a mac and am using emacs, but I can't seem to compile my program, I have tried M-x compile make -k and that...
[1 reply] : For anyone finding this thread, I have solved my problem, the problem ... (by Rob k)
by Fedeb
Store unkown size of input data
 
Hi, I have a set of files with the following format of data: File 1 A B C 1 1 2 2 1 2.2 3 1 3.2 4 3 4.1 5 3 4 6 3 4 Fil...
[6 replies] Last: To find lines of a file you could use std::getline. To find the numbe... (by megatron 0)
Project due need assistance
 
My tutor has given me these steps for one of our end of my year projects I am struggling with c and any help would be appreciated 1) Declare the 2d array (5...
[1 reply] : #include <iostream> #include <cstdlib> // Declare constants and map... (by megatron 0)
Stack not displaying items
 
Hi.. I'm doing an implementation of stack My program is working fine.. but when I displays the stack item.. it doesn't display the last item.. rest my progr...
[14 replies] Last: It is a way to easily get command line arguments that were specified w... (by AbstractionAnon)
by alexBB
.gch extension
 
Hi there. I have a few header files in my directories where I run my .c and .cpp codes. I just noticed that the g++ compiler generated empty files with .gch e...
[2 replies] Last: I am not sure they are empty, honestly, but when I open them with ged... (by alexBB)
Why in member function body I can define a obj of its own type?
 
I know that incomplete class type can not have a obj. But why the member function body can define a obj of its own type? class Test { public: void f...
[6 replies] Last: There is even simpler case than the OP's: struct foo { int bar() { ... (by keskiverto)
by oseri
POD members release moment in Destructor
 
I'm curious when are POD member variables released when calling a destructor. class L2 { public: int eCount; int GetCount() {return eCount;} ...
[2 replies] Last: When an object is destroyed: 1) Your destructor body is run 2) Des... (by Disch)
March 2015 Pages: 1... 2526272829... 51
  Archived months: [feb2015] [apr2015]

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