General C++ Programming - September 2012 (Page 22)

scope
 
When can you have method in private part and data in public part of a class?
[10 replies] Last: > When can you data in public part of a class? a. When the data is im... (by JLBorges)
PLEASAE HELP
 
Project 1 The Amusement Park Problem – ...
[6 replies] Last: No, you need to learn how to code ASAP. These boards aren't somewhere... (by MrHutch)
Extern variable problem
 
i have the following code THIS IS A.cpp int a=5; int inc(); int main() { printf("value of a is %d\n",a); a++; inc(); } i have another file which ...
[2 replies] Last: The problem is that inside the first module named A.cpp name a has... (by vlad from moscow)
What should i do to remove the error '++' needs l-value
 
I have the following code its an a.cpp file when i compile this code in visaul studio i am getting an error :- error C2105: '++' needs l-value at the line...
[3 replies] Last: word16 checksum(char *addr, word32 count) *((word16 *) addr)++ O... (by TheIdeasMan)
by majo
please help with C++ program
 
Please help I want to write three float function one for getSales to ask the user for a sales figure and return the sale figure, another one for findHighest tha...
[1 reply] : <sigh> http://www.cplusplus.com/forum/beginner/79002/ (by MrHutch)
WHAT IS THE BEST INSTALLER FOR Qt FRAME WORK?
 
I need to know what installer I can use for my Qt4 apps. Ofcourse the question is for those who are using C++ with the Qt4 framework.
[no replies]
stringstream acts crazy at double to string!
 
Hello guys, I wrote a function that converts any variable to a string using stringstream, the function is the following: template <typename T> std::stri...
[2 replies] Last: Oh, that simple! Thanks man. :) (by TheDestroyer)
Compute prime relation
 
I need a program that find a relation between two numbers entered by a user, and if the numbers share a common factor they will be a not relatively prime , othe...
[2 replies] Last: Just Code it... (by upX86)
Compile Problems
 
#include <iostream> #include <stdlib.h> using namespace std; int main() { double density, viscosity, diameter, speed ; do{ cout << "Enter Flu...
[3 replies] Last: You're asking the program to increment a variable named counter. Howe... (by MrHutch)
Trying to read words from a file into an array but still getting compiling errors.
 
I am still getting compiling errors. What I am trying to do is take a word 1 by 1 & put them into an array which in this case is labeled as "words". I contact...
[1 reply] : You want to change inFile >> words ; to inFile >> words ; . Simple ... (by monad)
How do I fix this compiling error (probably dealing with an array).
 
Here is my code: #include<iostream> #include<fstream> using namespace std; // Function Prototypes void readFilename(ifstream&, string&); void countNu...
[1 reply] : getline accepts only 1 element (ie: 1 string) line 81 is passing the w... (by soranz)
How do I read the number of characters and lines in a file properly?
 
First of all, I MUST pass by reference. My instructor said that the line counting & character counting SHOULD be done in the same function (but if I'm desperat...
[1 reply] : You are closing your inFile in the while loop. That's a problem! Sec... (by Stewbond)
What am I doing wrong with my arrays?
 
#include<iostream> #include<fstream> using namespace std; // Function Prototypes void readFilename(ifstream&, string&); void countNumberLines(ifstream...
[2 replies] Last: Yes, thank you. You definitely helped clear things up a bit but I am ... (by Ilithiya)
Concatenate an Array Into Another Array
 
Hi, I'm not sure if anyone had ask this question before, but I can't find an answer to this question on Google. So I have an array and I want to concatenate it...
[4 replies] Last: Thank you kbw, I will keep that in mind when declaring the size of the... (by Longazan)
How do I properly read in words from a file into an array?
 
Please help me. I don't know what to do. I messed up my code but I know it's only in "Function: populateArray". What I need to do is I need to pass in 2 refe...
[4 replies] Last: Thank you (by Ilithiya)
by rollie
Appending an integer to a string
 
I feel I am forgetting something basic - given: void log(const string & _str){...} what is an elegant way to write: int n = geterr(); log("Error code i...
[2 replies] Last: Use a function to log: template < typename T > std::ostream& do_log(... (by JLBorges)
Calling derived class method from a pointer to its base class
 
Hello again. I was wondering if there is a way to call a derived class method from a pointer to its base class. Example: class Class1 { }; class Class2 : ...
[4 replies] Last: Mh... I thought about other ways I could do what I need to do, and mak... (by strongdrink)
by vw4x4
why does this happen?
 
char ch; int ii; ch=200; int=ch; cout<<"ii ="<<ch; the result is ii=-56 and not 200 why?is this because of the range of signed char?
[1 reply] : is this because of the range of signed char? Yes. Assuming 2's co... (by Disch)
How do I write this code that reads & counts the number of lines & characters in a file?
 
Here is my function code, but apparently I screwed up big time, what the heck do I type? I am desperate. My friend told me there is a way to use a while loop ...
[2 replies] Last: Oh nevermind LoL I found an easier method. Thanks anyway. (by Ilithiya)
Expected primary expressions
 
I am trying to write a program that computes taxes. I keep receiving error mesages saying that there are expected primary expressions before certain things in ...
[4 replies] Last: If you indent the code properly these kind of errors is easy to spot. (by Peter87)
September 2012 Pages: 1... 2021222324... 32
  Archived months: [aug2012] [oct2012]

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