Beginners - June 2014 (Page 36)

Returning a specific value for use
 
How do I return a specific value from a function in order for me to cout it in my int main? In this case i have solved for a value sigma1 in my function but ...
[2 replies] Last: Yep they all work just fine Thanks alot :D ! (by sidthekid2014)
Help with pass by value, and results by variable
 
I need help with my online c++ assignment. The instructions: A nutritionist who works for a fitness club helps members by evaluating their diets.As part of...
[1 reply] : See section " Arguments passed by value and by reference " in http://w... (by keskiverto)
by p al
Erase elements from vector while iterating through vector
 
Hi guys, I am trying to erase elements from a vector that are equal to the 1st element of the vector. The following code works fine when v.size is even but it ...
[6 replies] Last: Oh thanks! That was the problem! I hadn't included the header algorith... (by p al)
by gladi
Not reading my file.
 
I am using xCode on mac and when I want to run my program and give me ERROR: opening file - LOCTest.cpp please some help. /*******************************...
[1 reply] : Try writing the file's absolute path. (by keskiverto)
by yepMe
Need to understand the logic of multiplication and addition logic
 
Hi Tech gurus, I am studying c++ using "Thinking in c++" now am in chapter 1 and solving the exercises , I have solved the last two questions Q9 ) Create 3 v...
[7 replies] Last: The idiomatic loop while( f >> word ) { /* ... */ } will execute onl... (by JLBorges)
by tdk93
Why isn't the value of y incremented after this, z = ++x||++y&&++z?
 
Why is the following program giving the output as y = 1 instead of y = 2? int x,y,z; x = y = z = 1; z = ++x||++y&&++z; printf("%d",y); ...
[4 replies] Last: Don't confuse operator precedence with the order in which the code i... (by Peter87)
Aggregation
 
Need help with aggregation of classes. Suppose class Passenger is aggregated to class Bus. Then how to overload = operator in class Bus. class Bus { ...
[1 reply] : class passenger { /* ... */ } ; // CopyAssignable class bus { /... (by JLBorges)
by lays
how to shut down keyboard input buffer to directly react my key strike
 
I am trying to write a game which need to control the action. It is obviously bad to press enter key each time. Because game needs infinit loop, so the wait...
[2 replies] Last: thanks. (by lays)
by tdk93
what's wrong with a>b?return(a):return(b);
 
What's wrong with the following expression? Why does it throw an error? (a>b)?(return a):(return b);
[1 reply] : return a is not an expression. a>b ? a : b is an expression. Eith... (by JLBorges)
Returning array in C
 
I am writing a program that needs to return the number of values that are divisible by 3 and 7 and the sum of these values.Here is my code #include<stdio...
[3 replies] Last: Instead of returning an array from the function, we can fill an array ... (by JLBorges)
by Life24
Space ascii code
 
Hi, I want get number while user insert space with ascii code(32) What i do? The below code doesn't work. char ch; cin>>ch; while (32 !=(int)ch) {...
[6 replies] Last: const int SPACE = 32 ; // hard-coded code-point for space (32) assert... (by JLBorges)
help with maze program C++
 
My program is supposed realize that it has hit a 'K', which is a key to unlock a door, and store it. I am not sure how to link the two. any suggestions on what ...
[3 replies] Last: If you are referring to removing the key once you have collected it t... (by Codermik)
by Nezar
I can't find the bug in this code
 
I'm trying to write a program that return the number of occurrence of a sequence of letters in a string. I'm really confused with what i made up !! help me fix ...
[5 replies] Last: Hey guys, Thank u for the solutions, it worked. To be honest, i didn't... (by Nezar)
nullptr
 
The code bellow seems to enter infinite loop, why is that? Thanks. #include <iostream> #include <cstdlib> #include <ctime> #include <stddef.h> us...
[3 replies] Last: wait you are right. Everything works fine now, i missed one definition... (by LayMuon)
Pushing elements from front of deque to the back
 
Hello, I'm wondering what the proper syntax is for this. I have a deque of pointers to class objects. I want to perform some actions on the front element, then ...
[2 replies] Last: Ahh, just noticed that as well. Thanks for the quick response! I had f... (by hinesro)
by sambos
Reading from files with Win Form App
 
Hi, I've written a program that has quite a number of labels. The program is a Windows Application Form written with Visual C++ 2010 Express. Within these...
[no replies]
Strings and binary data
 
This works fine char* mem; int bnum; GetFileCont("Capture.PNG", 0, 5000000, mem, bnum); ofstream out("Capture2.PNG", ios::binary); out.write(mem, bnum); o...
[7 replies] Last: Alternatively: char* mem; int bnum; GetFileCont("Capture.PNG... (by cire)
Need help with reading into array
 
i have a project that requires me to read all records from a disk file. (the record structure: name (20 bytes), grade (integer)). i have to sort the test scores...
[1 reply] : i have figured out most of it , just having some problems with my sort... (by darrrkjin)
by BLANKE
NEED HELP WITH IF STATEMENT
 
I need help understanding what is wrong with my program. I have read about if-statements on this website but that hasn't helped me much. When a user inputs bat,...
[7 replies] Last: Thanks for the help :) (by BLANKE)
Small Problem
 
Okay so this is what should be a simple enough code, i just want to create a function that will decrease the nHealth Value by the nAttack Value then output that...
[1 reply] : Your function doesn't do anything to modify your other values. It cr... (by Ganado)
June 2014 Pages: 1... 3435363738... 48
  Archived months: [may2014] [jul2014]

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