Beginners - February 2011 (Page 16)

program question
 
#include <iostream> #include <iomanip> using namespace std; //for single customers const double single_first_30_minutes = 7.00; const double single_afte...
[4 replies] Last: Yeah I don't know what I was thinking with the char holding 4 characte... (by DARKSUPR3MACY)
Negation
 
How do you negate a Boolean value: bool a, b; a = false; b = negate(a); What would the function negate() be?
[4 replies] Last: The point of the question was to figure out how to negate a boolean va... (by Zhuge)
automatic objects
 
Hi All, It is said in Stroustrup "An object constructed by explicit or implicit use of a constructor is automatic and will be destroyed at the first opport...
[6 replies] Last: Yeah, what I meant by objName being automatic was that the pointer its... (by Zhuge)
++ overloading
 
CmplxNo operator++ (int); //this is postfix ++ CmplxNo& operator++ (); //this is a prefix++ Q1. why is int in postfix Q2. why postf...
[5 replies] Last: ya . i get it. thx a lot zhuge ! ~Cheers! Neeraj (by navderm)
by linoch
writing definition of a function max
 
Hello, I'm a beginner of C++ and I'm trying to learn how to write a function from turingscraft.com. So, the problem is: Write the definition of a function ma...
[2 replies] Last: Yea... the error was from the site. I forgot to check for x = y = z. T... (by linoch)
by HMW
Sending array from one function to another
 
Hello all! I am working on a little project where I have a function that returns a value (integer), like so: number = my_function(text); So far so go...
[5 replies] Last: Hamsterman! Thanks again for your reply. I spent some time mutterin... (by HMW)
Arrays with characters
 
I want an array that has Boolean values associated with characters. How can I, for example, get thearray['a'] = false without displaying the warning: array s...
[1 reply] : By using a map: map<char,bool> theMap; theMap['a']=false; ... (by Athar)
by pooshi
Max Element in a vector of structs
 
Hello. I have a function that takes a vector of employee structs and I need to find the max salary in the struct. I am trying to use the max_element function f...
[1 reply] : Well, how is the compiler supposed to know what makes an employee "gre... (by Athar)
(Open GL) Making a colour transparent
 
I'm trying to create a side-scroller and I need to make a colour of my bitmap transparent. How do I go about doing this?
[3 replies] Last: Yes, it works for me, but you'll have to look up how to do a masked bl... (by rocketboy9000)
class pointers
 
I'm trying to create a class pointer that points to another class but I'm having issues. Its not working, my implementation is below CTile2 qOriginal; CT...
[1 reply] : You can't point to classes in C++, you can only point to class instan... (by Athar)
&& Operator
 
Hi, I know that you can use '&&' to say 'and' for ints. However, how do you say 'and' for strings? The compiler gives me this error: 1>------ Build starte...
[6 replies] Last: @packetpirate: IMO, that's just uglier and slightly less readable. Whe... (by filipe)
by theraz
simple greeting code, subtraction error.
 
Hi, i just started with c++ like 1½ hour ago, and I'm experimenting a bit. I wrote a script that looks like this: #include <iostream> using std::cout;...
[6 replies] Last: Thanks for all the replies, I prefer Danny Toledos method since that w... (by theraz)
std::ptr_fun explanation?
 
Here's a snippet of some code I have. // Check if the line starts with //, the program then ignores it but // it does display it to console and result...
[1 reply] : the isspace from cctype takes an int as parameter and returns an int. ... (by Bazzy)
Real Time
 
I created a program that displays simple mathematical questions. (Ex. 1+1=?) Now, I want to make it real time. As for example, each question must be answered f...
[3 replies] Last: Well, you can do all sorts of stuff with the console with ncurses, inc... (by Athar)
glPushMatrix & glPopMatrix
 
In lame man's term, what do these exactly do. I kinda finding it hard to imagine at the moment despite seeing this in a lot of code.
[1 reply] : glMatrixMult(some_matrix); glPushMatrix(); glMatrixMultf(some_o... (by hamsterman)
user input to an integer array
 
Hi, I want to set a user-define integer array for the following calculation: e.g. ISBN: 780225321-7 (7*1+8*2+0*3+2*4+2*5+5*6+3*7+2*8+1*9)=117 ISBN:...
[2 replies] Last: excuse me I am a newbie to C++. having only learnt a couple of lecture... (by kimkim0513)
Reading integers from file into array
 
So I'm trying to write a program that will read some integers from a text file, sort them, then write the sorted array into another text file. It is sorting and...
[1 reply] : Have you tried to actually code reading the numbers from the file? Wha... (by Zhuge)
position
 
[13 replies] Last: int leninbytes=(char*)(numbers+SIZE)-(char*)numbers; int leninelems=... (by rocketboy9000)
by amedxy
how to rounding
 
I have a number a = 12.3456, I need to rounding. Setprecision function only shows the rounding on the screen. I need rounding Can store in another, as I do? ...
[6 replies] Last: That doesn't work for negative numbers. (by rocketboy9000)
Looking for vowels, characters, etc. in a few strings
 
I have to write a program which outputs how many characters (letters+spaces), vowels, consonants, and words there are. The following code is my first attempt...
[2 replies] Last: Oh, sorry. I guess im just tired because there are a few really care... (by apearson28)
February 2011 Pages: 1... 1415161718... 43
  Archived months: [jan2011] [mar2011]

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