General C++ Programming - September 2018

Help with files and counter
 
This code is suppose to read a file with student ids and their test scores which then gets an averag...
[1 reply] : Let's look at this snippet: void readscore (int &id, int &test, int &... (by jlb)
by Lyrix
Which one cause std::bad_alloc
 
Thx class Solution { public: vector<string> solution; vector<string> findItiner...
[1 reply] : The scope of solution is incorrect. Your bad_alloc can happen in s... (by kbw)
problem with a cubic function code
 
I am a beginner with c++ and am experimenting with functions. I am trying to create a code that give...
[6 replies] Last: You can find the full method here: https://imgur.com/a/kX2mno3 Coded,... (by lastchance)
SIGSEGV on codechef
 
I submitted this code for this challenge https://www.codechef.com/problems/CHEFCHR and got a SIGSEGV...
[3 replies] Last: @Peter87, @keskiverto, thanks it's working now. I even got 100% :) He... (by Thomas1965)
Constructors
 
In c++ if I define a class to have a default constructor as well as a parameter based constructor bu...
[2 replies] Last: Look at the C++14 tab in http://www.cplusplus.com/reference/vector/vec... (by keskiverto)
Pass data of pointer to pointer
 
Hi, I am creating a function that will take a void * and pass its value to another void * Here i...
[3 replies] Last: You should work out why you're trying to write over memory that doesn'... (by Repeater)
by ram000
A simple question about why it always tells me character constant is too long
 
here is my code... #include <iostream> #include <string> using namespace std; int main() ...
[3 replies] Last: Thanks so much! I learned a lot today. (by ram000)
Need Help with my logic error for wind chill factor program.
 
Hello Community, I have an issue with my source code. I believe everything is in order when I do the...
[5 replies] Last: Thanks for that it was another arithmetic issue. Enter a value for F... (by NCCspartan85)
How would be resolved this typedef?
 
I have here a piece of code from a state machine, extracted from https://www.codeproject.com/Article...
[4 replies] Last: First, I thank you for your 'repairing', I fiddled at the code a more ... (by nuderobmonkey)
Class hierarchy
 
I have the following problem. I have an abstract class with a virtual function. < class A{ public:...
[6 replies] Last: > So no need to create these pointers, right? We are creating pointe... (by JLBorges)
by Kyoto
Cannot convert 'char(*)[20]' to 'char*' in initialization.
 
#include <stdio.h> #include <stdlib.h> #include <ctime> char location = {"south with beaches"...
[1 reply] : char* Plocation = location[rand()%5]; //try this. I didn't explain la... (by jonnin)
by kada17
Converting text from file into operations
 
I am writing a program that simulate an assembly language (MIPS). What it does is read binary string...
[2 replies] Last: Thank you for the array tip, I think I know what to do now. (by kada17)
pragma once and circular includes
 
I am used to using defines and #if directive to make sure that already included headers are not incl...
[8 replies] Last: That doesn't work the way you think. (but it would if you used ifndef... (by poteto)
Unresolved external errors
 
Hi there. I am trying to do a program for school but am getting 4 unresolved external errors having ...
[2 replies] Last: Got it, I did that for all of my functions and it works now! Thank you... (by thechamp1202)
Function pointers to operators
 
Just curious. Question within code. #include <iostream> using namespace std; struct Int{ int x; }...
[8 replies] Last: Thanks @coder777. A catch-22 situation indeed. (by lastchance)
Freind class function inaccessible because of template
 
So function from class A is not available to class B because B has a template type and A can't recog...
[2 replies] Last: Remove <N> template<typename N> friend class B<N>; (by Peter87)
Reading Text File with Delimiter.
 
So the file contains integers, string, and a delimiter ','. It looks like this in the file 1234, Wh...
[3 replies] Last: You do have: int studentIds ; ifstream inputFile; getline( inputFi... (by keskiverto)
by Vemund
I need a new challenge
 
Hi, I am a hobby C++ coder and used some years now with Arduino. I want to say goodbye to wires and ...
[1 reply] : AFAIK plugins for GIMP are written in python. Small practical tools f... (by Thomas1965)
Need Help
 
been working on this wage calculator for a while and i cannot get it to print the tax and net pay. p...
[5 replies] Last: Your tax_rate is 27.0. If your wage has no decimals and hours has no ... (by keskiverto)
cout won't work from within function (ambiguos)
 
Hello everyone, I am new to this site and decently new to programming. I am working on a school ass...
[1 reply] : We need to see your code to be able to help. Be sure you post the code... (by jlb)
September 2018 Pages: 123... 9
  Archived months: [aug2018] [oct2018]

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