General C++ Programming - February 2009 (Page 11)

how to convert from double to float?
 
hi, i've created this code to get the sin(x) value, but it keeps crashing my program when i run it. #include <iostream> #include <cmath> using namespace ...
[2 replies] Last: i was learning how to call the functions. i just changed all the doubl... (by deval90)
order of expression evaluation
 
hey can somebody please explain to me what is the order of evaluation of expressions in cout/printf and the order of printing i.e. whether it is left-to-right o...
[3 replies] Last: On second thought, I think each of the arguments are evaluated as sepa... (by helios)
General question
 
In C++, if the user-defined function is placed before the #include<iostream> and using namespace std; statements, __. A. cout and endl would not be recogniz...
[2 replies] Last: The question is poorly defined. It doesn't say what interfaces the fun... (by helios)
by Nona
by reference or by value
 
can sombody please help me and explain to me what is the difference between: function1 (int x, int y) and function2 (int& x, int& y) an example will ...
[1 reply] : Nona! go through this link http://www.tech-recipes.com/rx/1232/c-poi... (by skydbms)
casting
 
Is this a valid method to cast from hex to size_t? wordVector_ = (size_t)0xFF;
[1 reply] : Yes, but in C++ use static_cast instead size_t val = static_cast... (by jsmith)
piping to interactive programs hang?
 
Hi, I am doing a homework assignment that creates a shell to be used in a Unix environment. One of the requirements is that the shell accept piped commands. I...
[no replies]
[SOLVED]Passing a 2D Array Into a Function?
 
Hey guys quick question just wondering how to pass a 2d array into a function. Say if in a file I've made an array of int myArray ; etc. Now I want to pass ...
[2 replies] Last: I challenge you to come up with the correct syntax to return said arra... (by jsmith)
by SNOW
Key
 
I need help. I am making a game and it should work while ESC isn't pressed. The problem is how to do it. If I use getch(), it wait's for any key, but I don't ....
[1 reply] : You can use GetAsyncKeyState(VK_ESCAPE) from <windows.h>. GetAsyncKe... (by Scipio)
Is it possible to use the time.h to do this?
 
Alright so basically I want to know if it's possible to do something in the lines of: Get the current seconds "time_t seconds;". Compare it with a new value...
[3 replies] Last: Yes, now I see what you want :) I would make the time of seconds si... (by Scipio)
antivirus software
 
hello all i need to program an anti virus software .can u please tell me how i can go about doing it and what all i have to learn in order to do this . also ...
[1 reply] : If your looking at programming a "whole" antivirus software... You'd b... (by Mythios)
linking file stream with input file in C?
 
ok i was given an assignment but i have no clue how to do this. can someone please explain to me what i'm supposed to do cause i'm really lost. this is the prom...
[3 replies] Last: Use the code formatting option to make you code more readable [c ode... (by guestgulkan)
Classes and DLLs
 
If I'm not mistaken, DLLs only store code. Just functions. Then how can class information be hidden? Or it's not hidden? When a company creates a commercial DLL...
[7 replies] Last: Okay. I understand. Thanks :) (by Tom Backton)
Access violation reading from text file
 
Hello all, I have written a program to read strings from a text file. The text file is very brief and the fscanf functions seem to be reading the blank part...
[2 replies] Last: You maybe mis-interpreting the what you see. Those funny characters a... (by guestgulkan)
STL list random iterator
 
class A is a user defind class. if I have list<A*> in my code as follows. list<A*> m_lstAList; list<A*>::iterator itSt; for(itSt = m_lstAList.begin(); i...
[3 replies] Last: You could make a function to do it. template< typename Iterator ... (by jsmith)
How do I cast char array into childclass without breaking vtables?
 
I made a general memory manager that takes the size of any datatype and allocs a char * to that size. When alloc() is called it returns void * which is then ne...
[6 replies] Last: Ok, but be aware that you will not be running any constructors or dest... (by jsmith)
Type casting and function parameters
 
Let's say I have a function that takes a parameter of type unsigned char, does some calculations and returns unsigned short. One of the operations the function ...
[17 replies] Last: In other words, the conclusion is: for variables or small arrays it's ... (by Tom Backton)
by fire
Usage of mutator methods
 
Hi all! I don't really know whether this is a "Beginner's question" but maybe it is ,..well, if so: sorry for that Let's guess I have written a class whic...
[1 reply] : Personal preference. It is not more expensive if the methods are non-... (by jsmith)
how to keep the input order while inserting in multimap
 
I wanted to maintain the input order while inserting data to a multimap. my key is a int , and value is struct. but when i print the data using an iterator...
[3 replies] Last: Probably because he needs to at one moment get the elements based on t... (by helios)
Accessing members of parent class
 
Hi all, I have a class A and class B. Class B inherits from A. Class A has a protected member x. Class B has a method m which calls another method m1. In ...
[2 replies] Last: Sorry, it was a silly mistake! Actually member x was a vetor<int> typ... (by kunigami)
define classes with vectors?
 
is this possible or desirable ever? this is sort of an open question for instance, if i had a sports statistics input file of the format like <team name> ...
[3 replies] Last: If you create a struct containing the data, you will not be able to us... (by jsmith)
February 2009 Pages: 1... 91011121314
  Archived months: [jan2009] [mar2009]

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