General C++ Programming - March 2017

struct member access with array notation?
 
I could have sworn I've seen array notation used in the past for accessing struct member values. Maybe, it was another language and I'm just mixing syntax up. B...
[5 replies] Last: I think there's just examples of it in my system architecture book, fo... (by zerophase)
Converting compound literal array to C++ compliant form.
 
I have some C code I'm adapting to compile under C++. Currently, it compiles as is only in Clang, but I need the code to be compatible with GCC and MSVC. The on...
[11 replies] Last: Yeah, ended up replacing it with some string manipulation. I didn't ne... (by zerophase)
by Ozzy69
Open and close a file in c++
 
Hello guys, I have 2 tiny question about open and close a file in c++, cause the program dont iexplore dont close and put a text in code format this forum. For...
[4 replies] Last: Thanks a lot man (by Ozzy69)
make rectangular a non-rectangular multidimensional vector
 
Hello people, I want to write a template that receives a -not necessarily rectangular- multidimensional vector (vector of vectors of ...), checks if it is non-...
[1 reply] : It seems like I found here a non very orthodox solution: // templat... (by dariodem)
by tushu
How to print graph using vector of vector ?
 
#include <iostream> #include <vector> using namespace std; void addEdge( vector<vector<int> > adj, int, int); void print_graph(vector<vector<int> > adj); int...
[1 reply] : Meaningful variable names can act almost like a debugging tool and if ... (by gunnerfunner)
switch case with wchar_t
 
Hello normally i use if to check but when i have a lot of conditions is very painful. So i was thinking to use a switch case like the most efficient way.. obvio...
[4 replies] Last: the trouble was trying to switch off a non-integer. but that will he... (by jonnin)
Few qustion - any expert C++ programmer help me!
 
Hello there, i am programmed in c++ for a while and left it for like few month now i have come back.. i really enjoy and soon ill upload code for a game i made ...
[5 replies] Last: headers have definitions of classes, functions, constants, and such. ... (by jonnin)
im so confused
 
below is a function i'm trying to write but i'm confused. i'm supposed to make a point in here called a pivot that divides this array of random size. it's sup...
[6 replies] Last: I suggest to go through your code a few times and search for those kin... (by benhart)
chocolate vending machine errors
 
On line 32, i am having an error saying '<':signed/unsigned mismatch, can anybody please tell me why this is? also, from lines 98 it is saying 'Chocolate_Dispen...
[2 replies] Last: 1) As TheIdeasMan says, please don't start multiple threads on the sam... (by MikeyBoy)
Problem with random map generation
 
Hi programmer community! I've got a problem. My program is supposed to generate a random map with roads and houses. The problem is in the house generation sect...
[3 replies] Last: I FOUND IT! It was a really dumb mistake... And hard to spot! The foll... (by goldenchicken)
Gratuity calculator
 
Alright fellow c++ programmers. I am having a headache of a problem with this program. my difficulty comes from the fact that it needs to be broke down into 3 p...
[2 replies] Last: Green tick this one too please. That way it will be ignored. :) (by closed account 48T7M4Gy)
Using overloaded functions
 
So far this is my code; I'm supposed to write a program with two overloaded functions both named triangleArea. In main, randomly ask the user to enter either b...
[1 reply] : #include <iostream> #include <cmath> // sqrt function using namespac... (by closed account 48T7M4Gy)
Gratuity calculator
 
Alright fellow c++ programmers. I am having a headache of a problem with this program. my difficulty comes from the fact that it needs to be broke down into 3 p...
[8 replies] Last: main sill right? or? Whatever that means. Just make up the 3 files a... (by closed account 48T7M4Gy)
Error printing doubly linked list backward
 
I am having one issue with the follow code, and that is if I tell it to generate 1 node it throws a seg fault error on the print backward function. If I tell it...
[1 reply] : Here's a general outline of a reverse print method: void printRevers... (by gunnerfunner)
binary input
 
I have a binary string for input, for example 0110011, the input is being read left to right one at a time; in the ASCII chart decimal 48 is ASCII 0, and 49 is ...
[3 replies] Last: > in the ASCII chart decimal 48 is ASCII 0, and 49 is ASCII 1 The enc... (by JLBorges)
chocolate vending machine code
 
I have been asked to create a chocolate vending machine. So far i have produced a large amount of code, however i am confused as to what is stopping the program...
[3 replies] Last: lines 212 and 216 are now the only lines giving me errors, the errors... (by TheIdeasMan)
Program Help
 
My program is suppose to output these inputs. I think I made the program to complicated also. Any advice? AH QH TH 8H 4H The rank of the hand is: Flush ...
[1 reply] : I think you can combine some of the tests, rather than a function for ... (by jonnin)
boost::asio confusion
 
I've been working with the Boost libraries for a few years now, and while they're helpful, boost::asio is a library I find wanting to use, but time and time aga...
[4 replies] Last: Well, running it alongside Wireshark, I've noticed that, often, the tr... (by Innominat)
by cmisip
Creating libao class objects. Why does audio only play once.
 
Can't figure out why audio_sample objects only plays audio one time. Any ideas? Thanks, Chris /* * To change this license header, choose License Headers in...
[5 replies] Last: For some reason I thought global variables are not visible in class de... (by cmisip)
by Kalcor
Functions & Pointers
 
Hello , I was trying to solve a problem that I was facing while trying to understand pointers correctly and its kind of a mystery to me atm. #include <iostrea...
[4 replies] Last: You're awesome, thank you very much <3 (by Kalcor)
March 2017 Pages: 123... 19
  Archived months: [feb2017] [apr2017]

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