General C++ Programming - January 2018

by stav
Multiple variable names?
Hi i have a Time class that calculates a deltaTime and i thought it would be neat to make it so that you can retrieve it using both: Time.deltaTime ...
Jan 31, 2018 at 11:02pm
[3 replies] Last: While we're at it, why not just use the <chrono> facilities? They do a... (by Duthomhas)
by Thelps
Convert char from filestream to lowercase..?
Hi all, Please read before posting: I'm taking data from a ifstream filestream (that's reading from a .txt file) and placing it into a char variable. T...
Jan 31, 2018 at 8:55pm
[1 reply] : tolower(currentChar); That doesn't change currentChar. It's a funct... (by Repeater)
by slei
multi line macro in multiline macro
hey is it possible to have multiline macros in muliline macros? not sure how to do this, if anyone can help, here is an example: #define A(B)\ int count = 0;...
Jan 31, 2018 at 9:52am
[3 replies] Last: oh man, i didn't even notice I'm trying to use a loop outside of a fun... (by slei)
by CalebS
I/O records seperated by {}
New to file I/O and c++ in general, would greatly appreciate any help or if someone can point me in the general direction. The goal is to read in a file where ...
Jan 31, 2018 at 9:44am
[2 replies] Last: #include <iostream> #include <fstream> #include <string> #include <ve... (by lastchance)
Keypad State Machine
I'm working on a state machine which displays the letters A, B, and C in that order. If at any point while displaying the letters I press the 'A' key, I should ...
Jan 31, 2018 at 8:31am
[no replies]
division in C++
Hello friends, I have a small question. why does cout << 11 % 3 << '\n'; gives 2 as an output? I am really confused because the answer from the calculator...
Jan 31, 2018 at 6:05am
[5 replies] Last: Remember, floating-point constants are type double by default. In List... (by sm2345110)
c++ function return
#include<iostream> using namespace std; class test{ public: test(); ~test(); int a = 0; }; test* GetTest(){ } int main(){ te...
Jan 31, 2018 at 5:05am
[1 reply] : why would it be? you don't set anything to null anywhere. temp is ... (by jonnin)
C++ Posts by a forum member
Is there a way to see list of all threads that have a post by a given forum member. For example, there are many threads that have excellent posts (i.e. input...
Jan 31, 2018 at 12:20am
[1 reply] : Perhaps a more experienced user knows, but I don't think that's availa... (by Ganado)
by blaq
Dynamic Array of Classes w/ defaults
Hi, I made an class that requires passing 2 variables by default: class TestClass { public: TestClass(int, int); ~TestClass(); } TestClass::TestClass(...
Jan 30, 2018 at 11:58pm
[1 reply] : Are you sure about the "need"? If you would not need "dynamic array",... (by keskiverto)
Generating random number input (to be used 6 times)
I am creating a random guessing game in which I need to generate an input 6 times. I know how to generate a random number but I don't know how to generate a ran...
Jan 30, 2018 at 10:57pm
[2 replies] Last: Basically a a random number is generated and the user inputs a guess. ... (by captainsasss)
by Mk87
How to implement 3 digit binary numbers into 2D vector in C++?
I want to write a C++ code contain all 3bits binary numbers into a 2D vector like the following matrix: 0, 0, 0, 1, 1, 1, 1 0, 1, 1, 0, 0, 1, 1 1, 0, 1, 0,...
Jan 30, 2018 at 10:16pm
[4 replies] Last: Well, you will have a vector< vector<int> > if you change line 6 of my... (by lastchance)
I NEED HELP ASAP!!!
ok guys, im trying to code a grade calculator for my programming class and my if/else if block is screwing me over because it equates y/n to elicit the same res...
Jan 30, 2018 at 6:51pm
[5 replies] Last: nvm, got it (by matiasp1998)
Why am I receiving the following error code: "undefined reference to 'displayMonthlyReport (MonthlyBudget const&)'
/* Program Description: Asks for monthly living expenses. Calculates and displays the difference between the expenses and budget. Inputs Needed: Student...
Jan 30, 2018 at 4:54pm
[2 replies] Last: THANK YOU (by jimothy87)
Need help opening a file from user input.
I get an error that says, "no matching function." On the line with the file.open() function. #include <iostream> #include <fstream> using namespace std; int...
Jan 30, 2018 at 3:55pm
[2 replies] Last: I am using c++11 and i still get that error message for some reason. ... (by raptorjesus)
by stav
sfml texture shared_ptr error
Hi Im using sfml and im trying to load a texture Ive made a map of strings and textures, m_textures: std::map<std::string, std::shared_ptr<sf::Texture>>...
Jan 30, 2018 at 3:15pm
[6 replies] Last: If the MyAssetManager object is static/global are you sure that it has... (by Peter87)
by dbag
Coordinates Reprojection with GDAL
So I am trying to re-project a coordinate from WGS 84 / UTM zone 33N (Meters) to WGS 84 (DD). I have tried the below method but when it gets to the portion to t...
Jan 30, 2018 at 2:01pm
[2 replies] Last: Your right it does appear to be returning a null pointer (by dbag)
Pulling data from a text
I'm new to C++ and I'm having issues pulling data from a .txt file. What I have is a .txt with multiple entries per line; it looks like. firstName midName last...
Jan 30, 2018 at 2:00pm
[1 reply] : Your code will look something like this: ifstream infile(filename); ... (by jonnin)
Compiling .cpp files separately
Hi. I would like to use a C++ library to deal with sparse matrices. One library that I came across is called ALGLIB. When I downloaded and unzipped the file,...
Jan 30, 2018 at 9:31am
[1 reply] : VS2015 has some kind of solution explorer, I think. If you right click... (by Repeater)
C++
Coding for a rock paper scissors game Function > bool isMoveGood(char move); My Response > void test_isMoveGood() { if ( (char move == R) || (char ...
Jan 29, 2018 at 9:56pm
[7 replies] Last: there isnt even any code past a cin and cout statement if you make a 2... (by jonnin)
by YikUTM
How do get enemies to run around the maze game
I managed to write a maze game but I wished to add enemies to run around. Can somebody tell me how to do this? #include <iostream> #include <windows.h> ...
Jan 29, 2018 at 9:43pm
[1 reply] : what do you want them to do? you can plop them down somewhere and ev... (by jonnin)
January 2018 Pages: 123... 10
  Archived months: [dec2017] [feb2018]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.