General C++ Programming - January 2016 (Page 9)

return pointer type
 
Is there any function/way to return the type of a pointer? ... int value = 5; void *void_ptr = &value; //here int * int_pointer = static_cast<int*>(void_ptr)...
[7 replies] Last: I am starting to learn that C++ is there for a reason, and some of th... (by TheIdeasMan)
Help! I'm not satisfied with this code fragment.
 
My goal is to read a set of lines from a file and print out the lines containing a "keyword" along with their line number. I've managed to do so, but I'm unsati...
[1 reply] : A little wordier than yours, but it avoids a few allocations/copies. K... (by cire)
implementing header file in .cpp file
 
This is my .cpp file: 1 #include "HCTree.hpp" 2 3 using namespace std; 4 5 void HCTree::build(){ 6 cout<<"jdf"<<endl; 7 } and this is my par...
[no replies]
c++ income tax homework
 
Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For single people, the standard exemption is $4,000; for marri...
[1 reply] : Do you have a question or are your intentions to waste our time? (by TarikNeaj)
Non Numeric Inputs
 
How should I code my program to recognize inputs that are not numeric. Whenever a user inputs a letter in my code the code starts repeating infinitely. I know...
[1 reply] : http://stackoverflow.com/questions/18728754/checking-input-value-is-an... (by TarikNeaj)
Need help
 
#include <iostream> using namespace std; int main() { short i; i=3; ++i++=++i++; cout << i; return 0; } Can someone please explai...
[2 replies] Last: It does not work. It does not even compile because ++i++ is invalid C... (by Cubbi)
by jres
Subset sum problem with negative integers
 
Take a set A with n_A members. The problem is then to find out whether or not a subset of set A can sum to equal a target. This is a variation of the subset sum...
[3 replies] Last: It seems to me that this algorithm will give false negatives even with... (by helios)
destroy foo
 
How do I destroy foo? struct Foo { type value; type FooMember = value; } ... int main() { Foo foo type value_1 = foo.FooMember; /...
[2 replies] Last: yep, go it! (by technologist)
by Ozzy69
Help me with program
 
To display the character %, the sequence %% is used, but to display "" as I lay in printf? Because """" is not working
[1 reply] : \" (by Moschops)
by rain
Cant use command line argument as map key
 
Hi. I have problem with my program. If I use numbers["one"] directly then it prints me 1 but when I use numbers[argv ] I get 0. Why is it so? It's very strang...
[3 replies] Last: When I used char*, it iterated in order I added items in this map. ... (by Moschops)
dangling pointer
 
Does delete n_ptr delete the memory n_ptr is pointing to? A * n_ptr = new A(); cout<<n_ptr->value; cout<<endl<<n_ptr<<endl; delete n_ptr; cout<<n...
[5 replies] Last: When we do this: delete n_ptr are we decoupling the pointer from t... (by Moschops)
Please help in rectifying the error in C++ code
 
#include<iostream> #include<conio.h> #include<stdio.h> using namespace std; int count=0; struct airline { int ano; char fname ; char lname ; in...
[1 reply] : You declare your variable res to be of the type airline (a structure t... (by Shadowwolf)
Pi Values Using Leibniz Formula
 
I am still in the learning process of C++, and I have this assignment due Monday. My problem is that I have no idea how to get started. Here is the homework I w...
[3 replies] Last: My suggestion, for what it's worth. Notice how the terms are grouped i... (by Chervil)
conio.h & stdio.h
 
Write a program to read in the user’s name. User can type a maximum of 25 characters including spaces. When user ends the entry with <enter> key, or the max...
[1 reply] : #include <iostream> int main() { const std::size_t INPUT_LIMIT =... (by JLBorges)
by k1135
Assignment Help Please
 
Hi I have an assignment, probably easy for a lot of you but im new to this programming and trying to understand little by little. Assignment You are to cre...
[1 reply] : Your location need to be an array. double Loc ; To get get/set th... (by Thomas1965)
by zoda
10 is an odd number
 
When I run this code, I get "The product of 5 and 2 is 10 and is odd. The sum of 5 and 2 is 7 and is odd." Which obviously is not correct since 10 is not odd,...
[2 replies] Last: I assume this is what u wanna do... :) #include<iostream> using nam... (by Frooster)
static_assert does not tell me which type is offending
 
Hi, I am having the following compiler error: static_assert(is_enum<_Tp>::value, "This hash only works for enumeration types"); However, I don't know...
[3 replies] Last: a compiler I don't know if you chose to use such an eccentric operatin... (by ne555)
Help!!! trouble with Array loading and Debugging
 
I'm having some issues with this project I've got a baseline of code but my void is reading as incomplete. I'm thinking that it might have to do with the loadi...
[9 replies] Last: > Another might be to create a uniquely-named output file from your pr... (by ne555)
Help! input file won't open
 
I can't figure out why my input file won't open. #include <iostream> #include <string> #include <iomanip> #include <fstream> using namespace std; //f...
[1 reply] : - The file does not exist (different name, different directory) - You ... (by ne555)
SFML storing drawables?
 
Hello! I'd like to make games in future, so I started learning SFML. In sfml there are classes for e.g. texts, shapes and others, which all derive from sf::D...
[9 replies] Last: Ok, thanks I'll go with what Moschops suggested, probably with priorit... (by TheHardew)
January 2016 Pages: 1... 7891011... 18
  Archived months: [dec2015] [feb2016]

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