General C++ Programming - February 2017 (Page 3)

why declaring a pointer is like declaring a dynamic size array ?
 
i learned that arrays are that of a fixed sized containers then why doin this , is valid in c++ int y =5; int *x = &y; x = 54; cout<<x <<" "<<x <<en...
[2 replies] Last: x = 54; You're trying to access memory that you haven't allocated m... (by integralfx)
Text Abbreviation Code Problems
 
Hey there, I'm trying to write a program that will output the expanded version of text message lingo. For example, if the user inputs "LOL", the output will be ...
[4 replies] Last: #include <iostream> #include <string> using namespace std; int main... (by closed account 48T7M4Gy)
c++ commenting
 
Can anyone help to explain this section of coding from a stack and queue program? Such as adding some explained commenting for me to get a better understanding...
[2 replies] Last: Ill take a crack at it, and assume you don't know much. template <... (by jonnin)
by vgdd
What are multidimensional arrays
 
What are multidimensional arrays? I need to code a word jumble game but I have to use them and I don't know what they are.
[2 replies] Last: a slow way to access memory :) It's possibly slower only if done in... (by mbozzi)
by Drakk
help with an assignment
 
So I have been trying to create a program to match the requirments given in ym current assignment. Write a program that quizzes students on simple integer arit...
[8 replies] Last: http://www.cplusplus.com/forum/beginner/209428/ (by closed account 48T7M4Gy)
How can I move decision to compile time?
 
Hi, I have this code: template < class TargetUnits, class SourceUnits> struct factor { private: typedef ratio_divide<TargetUnits, SourceUnits> r;...
[9 replies] Last: The original code (with the if) does not involve creation of any secon... (by JLBorges)
Trying to find the most common factor
 
So, I am practicing for a school competition coming up, and I am stumped on this problem, it just simply won't work, what am I doing wrong? It is supposed to...
[3 replies] Last: > what was wrong with my original code? 1. This is not allowed in C++... (by JLBorges)
by nyvrem
BitVector Expand function: 'BitVector out of range' error
 
My task requirement to implement an 'Expand' function of a bit vector in the BitVector class is as follows (header and main files are provided): 1. Implement...
[3 replies] Last: I reread your original post. You're saying that 'Expand' only fails wh... (by xismn)
what's wrong with this code?
 
const int ROWS = 2; const int COLUMNS = 3; char board = {{'0','X', '0'}, {' ', 'X', 'X'}};
[2 replies] Last: Thank you for you're help! I gratefully appreciate it :) (by prettyawesome6)
Which HTTPD libraries do you use?
 
Which HTTPD libraries do you use?
[no replies]
Load bitmap into WinBGim
 
Hello, i'm using WinBGim to draw some graphs. This part I did it with no trouble, but i'm stacked trying to load a bitmap into that draw. I've found the functi...
[no replies]
Help printing Calendar to file
 
I have finished everything with my code except for printing the year ond the months to a file. #include <iostream> #include <string> #include <iomanip> #inc...
[1 reply] : I noticed if your starting day for the month is not Sunday, the number... (by SamuelAdams)
Infix to Postfix conversion. Am I on the right track?
 
//Am I on the right track? #include <iostream> #include <fstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <st...
[5 replies] Last: 1. On lines 84 and 90 you're doing assignment (=), not comparison (==)... (by helios)
Need help creating a program that outputs a 6 digit number that fits specific criteria
 
For a homework assignment i am required to output all numbers that meet the following criteria 1. Must be a six digit number 2. All digits unique (none are ...
[12 replies] Last: fun fact... if the sum of the digits is divisble by 3, so is the numbe... (by jonnin)
by vgdd
Programming NIM with 2 players
 
Hey! This is my code so far and it works fine but Player 2 cannot win only Player 1. Anyone know how to fix this! #include <iostream> #include...
[1 reply] : @vgdd You don't have any coding done that checks if player 2 wins. Al... (by whitenite1)
by elsa
can't access variable inside protected class
 
};
[2 replies] Last: When I try your method, I get an insanely large negative number as the... (by elsa)
Need help understanding.
 
This seems like a really simple question, but it bothers me when I don't understand why something does something, so... I need help with this. void calculation...
[1 reply] : opChoice == 1 compares for equality. It evaluates to true if the ope... (by JLBorges)
Moment of evaluation of a template differs for subclass??
 
Hi, I have the following code: template<typename T1, typename T2> struct common_type_metafunction : std::common_type<T1,T2> {}; And this is use...
[4 replies] Last: Thanks!!! Juan (by JUAN DENT)
by vgdd
What is wrong with this code
 
for (int i=0; i<= phrase.size(); ++i) { cout <<"Character at position"is": <<phrase << endl; }
[2 replies] Last: The size of the container is not a valid index so you need to use < in... (by Peter87)
How to define a virtual class member function in .cpp file that is declared in .h file
 
Hi, I am trying to put all class declarations in .h file and all definitions in .cpp files. But I am unable to define virtual class member functions in this w...
[2 replies] Last: Thanks @Golden Lizard :) (by kapil2905)
February 2017 Pages: 12345... 16
  Archived months: [jan2017] [mar2017]

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