General C++ Programming - February 2018 (Page 4)

Reading and printing from a Text file
 
i am trying to read and print from a text file. This code only print one row instead of 5 rows. I have no clue now. F F F F F This is what i am getting bu...
[1 reply] : If you only want to read and print a file you can do it like this: i... (by Thomas1965)
My vector class isn't working when i create objects
 
Whenever I try to create an object I get this error: "Implicit instantiation of undefined template 'std::__1::vector<int, std::__1::allocator<int> >'" Here...
[4 replies] Last: Oh no it doesn't, I didn't realize it needed an overload operator. Tha... (by joshgarza)
Help Needed asap! I really need help!!!!!!
 
I created the code below with three functions, I am having trouble implementing the following: *Ask customers to select multiple products and quantities *Print...
[10 replies] Last: About why the program closes: I have no further suggestions If you wa... (by longberns)
Code Blocks 17.12: how can i add include directies?
 
imagine that i have installed DirectX SDK or even the OpenGL. how can i add the include directory? these is an adicional include directory.
[14 replies] Last: Directx SDK is donned by Microsoft. so GNU isn't compatible with it. i... (by Cambalinho)
defining function inside funtion.
 
c++ gnu compiler doesn't allow defining functions inside functions. actually what is the process behind the compiling process due to which this type of defining...
[10 replies] Last: I think I'm starting to understand why nested functions were never add... (by Peter87)
Sharing Header files (Visual Studio 2017)
 
Hello, the problem is, I'm not able to share the files I need, the compiler gives a disgusting and very annoying errors. My first header file "Game.h" : (i'm ...
[6 replies] Last: kk (by hassanAman)
How to Change Static to Dynamic Arrays?
 
Hello Professionals, I had a discussion with my professor recently about the program I am currently working on. I explained to him that when I tried to initial...
[7 replies] Last: Thanks @coder777. You are correct :D (by kindgnice)
Help with program (if statement)
 
There is something wrong with the commented out portion of the code where the if statement is always running and making the boolean false when it should not be....
[1 reply] : Either // if (arithmetic_operator != '+' || '-' || '*' || '/' || '%')... (by JLBorges)
Need help with rvalues and move constructor/assignment operators
 
I have troubles with rvalues and move operations. #include <iostream> #include <unistd.h> #include <thread> #include <sys/time.h> struct V { V(V &&v) { ...
[4 replies] Last: > I am working on arduino project and I suppose its compiler isn't sma... (by JLBorges)
by helios
Casting pointers the hard way
 
Consider the following class hierarchy: class S{ /*some data*/ }; class A : public virtual S{ /*some data*/ }; class B : public virtual S{ /*some data*/ }; ...
[6 replies] Last: In the end I figured out this doesn't work. If there's a virtual inher... (by helios)
Reading from a file
 
i am trying to read a file which already exist in my system as (proj1_test1.txt) but when i rum my code it didn't print the file. This is the code that i got so...
[1 reply] : Here are the last few lines of your code, indented to show the actual ... (by dhayden)
by bdwe
Need help ASAP!! please -hardest question ever for me-
 
Try your best please! Q:- - Using a for loop statement to a. Display the third power of following numbers 1, 2, 3, ..., 50 b. Calculate and display the s...
[2 replies] Last: Those are actually 3 different questions. Each of (a), (b) and (c) wo... (by doug4)
differnces between declaration and definition of functions and global variables.
 
hi, i have confusion regarding access of global variables and functions. i know that global variable can only be accessed with extern syntax but function can b...
[3 replies] Last: // declaration of a function: that this is only a declaration is impl... (by JLBorges)
by turqo
Array Column Sort with quality score
 
Hi I want to implement a code in C++ in which I would like to sort columns in an array according to a quality score, any help is greatly appreciated. example ...
[4 replies] Last: Ok thanks!! -std=c++ worked fine (by turqo)
by DCole
Adding a Default Constructor
 
Hello, I am new to C++ and have been reviewing the forum and watching video tutorials to assist me in creating a constructor for my program listed below, that w...
[3 replies] Last: Thank you both for your input. I am working on modifying my code to a... (by DCole)
vector of objects error
 
this code is giving me an error in the neurons .GetArrInput(arr); function // AI.cpp : Defines the entry point for the console application. // #include "st...
[17 replies] Last: i got neither of those warnings If you're compiling with GCC or Clang... (by mbozzi)
Vector & list
 
Hello, I just wanted to ask what is list equivalent to vector's : vector <int> ints; ints.push_back(12); cout << ints << endl; // how do you access el...
[10 replies] Last: I think the erase-remove idiom is the closest you get to an equivalent... (by Peter87)
How to drop a piece into Connect4 board?
 
For some reason, it won't re-print the board with the new piece. Is my drop function even right? https://pastebin.com/7YCWZCZp
[1 reply] : if(board == ' ') { board ... (by Ganado)
Parse Parentheses
 
Write a program to implement Algorithm 3-9, “Parse Parentheses,” matching braces rather than parentheses. In your implementation, push the line number int...
[1 reply] : You can do something similar to make a code prettier, tracking indenti... (by jonnin)
by jbohol
C++ General
 
Hello Masters, Greetings! For how long will c++ last? Just a curious question, if the language will last 30 to 50 years. Regards, jbohol
[7 replies] Last: It will easily last 25 more. While you need a working crystal ball t... (by jonnin)
February 2018 Pages: 123456... 11
  Archived months: [jan2018] [mar2018]

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