General C++ Programming - May 2013 (Page 5)

by Daleth
String literal with constexpr
 
I have a binary identifier which I tried to make a constexpr since all of its calculations would never occur during runtime (this is true for literal identifier...
[4 replies] Last: Alright, thanks for the suggestions. On a side note, how come you don'... (by Daleth)
C++ ARRAY_SIZE() - why you still need a macro
 
Now, as I'm primarily a Visual C++ developer, I use the _countof() macro which is provided by the Microsoft version of stdlib.h. For C, this is just #defin...
[no replies]
Inheritance problem
 
Hi, I have an abstract base class - let's call it MyInterface - and a class that most classes in my program inherit from, let's call it MyBaseclass. Let's...
[2 replies] Last: Your comment made me start thinking in a new direction, I've solved i... (by Andersson)
by naz
How many bytes will the pointer intPtr of type int move in the following statement? intPtr += 3 ;
 
How many bytes will the pointer intPtr of type int move in the following statement? intPtr += 3 ; (a) 3 bytes (b) 6 bytes (c) 12 bytes (d) 24 bytes ...
[2 replies] Last: 3*sizeof(int) bytes. So (b), (c) or (d) depending on machine. (by MiiNiPaa)
Runtime speed integer versus double
 
Dear fellow programmers, Is using integers faster than using floating points? Or more precise: what do you estimate as the chance that writing a custom float...
[2 replies] Last: MiiNiPaa, Thanks for the reference! I posted my conclusions (and tha... (by Bilderbikkel)
C++ Files / End of Line
 
Hi, i have a question about files in c++. I need to do a program that reads a .txt file and stores it into a bidimentional character array and the show it in...
[2 replies] Last: The call to getline() is its own end-of-file condition: like most othe... (by Cubbi)
by naz
Choose the correct answer.
 
Consider the following code segment. What will the following code segment display? int main(){ int age = {0}; cout << age ; } (a) Values of all elem...
[1 reply] : http://www.cplusplus.com/doc/tutorial/arrays/ (by Fransje)
by naz
Identify the errors in the following code segment and give the reason of errors.
 
main(){ int x = 10 const int *ptr = &x ; *ptr = 5 ; } main() { int x = 10; const int *ptr = &x ; cout <<ptr; } Identify the errors in the followi...
[1 reply] : http://www.thegeekstuff.com/2012/06/c-constant-pointers/ (by Fransje)
Building Bridges
 
**Problem:** There is a river that runs horizontally through an area. There are a set of cities above and below the river. Each city above the river is matched...
[no replies]
Direct X is so hard
 
I have just gotten a book called programming 2d games by charles kelly(using c++) The book teaches direct x9. I have finished learning all the basics in c+...
[1 reply] : You must understand the DirectX interface and the API functions associ... (by Nexius)
Thank you for all the help so far. Any ideas on this?
 
This is what I have to do: In most companies the amount of vacation you receive depends on the number of years you've been with the company. Create a c++ pro...
[3 replies] Last: Hi dragonscrapper; i modifeid your code since it has alot of syntax an... (by Zaki Al Qudah)
Passing 2d array to pointer in C++
 
Kindly remove one error. #include <iostream> using namespace std; void insert_values(char **p); int main(){ char a ; insert_values(a); ...
[4 replies] Last: In the code above the row and col are the wrong way round on line 18. ... (by andywestken)
ifstrem bytes buffer
 
I need to read whole binary file and pass bytes buffer to third party function. Currently i am filling the file content into vector, but this seems somewhat re...
[3 replies] Last: PS: looked at the execution of ifstream::read() for a large binary fil... (by Cubbi)
by ReVolt
C++ threads
 
hi, I've downloaded tinithread++ for c++ and i can't see option to pass data to function while creating thread, is it possible in tinythread++? could you rec...
[4 replies] Last: thanks, it's quite new to me so i did not know :) (by ReVolt)
Function problem
 
#include <iostream> #include <iomanip> #include <cctype> #include <string> using namespace std; void logo(); void initialize(int SCLASS , int ECO ); ...
[3 replies] Last: The same way as it would return any other variable. Whatever turorial... (by MikeyBoy)
by Moloer
Question to come later
 
Write your question here. #include <conio.h> #include <stdio.h> #include <math.h> #define LIMIT 0.999999999999999 #define MAXTERMS 100 double taylor...
[1 reply] : Part (a) printf("%.3lf\n", d ); printf("%+12.2lf\n", d ); printf("%0... (by Moloer)
character array
 
write a program that ask his or her name and store it in a character array
[1 reply] : Please note, that it is not a homework site. We won't do your homework... (by MiiNiPaa)
by DanT
Partial template specialization with template class
 
Hello, I have a generic template class with another template in one of its types. Now I want to specialize one of its methods for a particular (template) class,...
[1 reply] : Look here: http://stackoverflow.com/questions/5688355/partial-special... (by KRAkatau)
by crobar
Call to global fcn in template class static helper fcn result in linker errors, but not calls in member fcns?
 
Hello, I'm a newbie to class templates, and a moderate C++ programmer in general. I have a project which uses the autotools build system to create a static l...
[4 replies] Last: xhypot is a global function declared, in an included header in real.h ... (by crobar)
problem in float function of percntage
 
hi guys,, below is the code of a program using classes and functions ,, my float function doesn't show answer in fractions ,, show something else,, anybody plea...
[6 replies] Last: Thank you guys.. Its been so nice of you,,, its solved now,, #include... (by junaidkhan2013)
May 2013 Pages: 1... 34567... 47
  Archived months: [apr2013] [jun2013]

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