Beginners - April 2019 (Page 17)

2D Array with Restricted bounds
 
I have a 2D bool array with 400 elements with a random assortment of spaces " " and asterisks '*' where '*' is true and " " is false. I need to create a functio...
[12 replies] Last: I figured it out. Just had to remove a couple of the equal signs in th... (by stoneJax)
Splitting an array in 2
 
Hello, I'm having a bit of trouble starting the code for a project. The problem states that you are to take an array with 20 numbers, written in another file, ...
[7 replies] Last: You tell me. Right now, you're incrementing j and k with every loop. ... (by Repeater)
by vysero
Help to understand how this function works.
 
I have a bit of code here that seems to me to be searching the wrong place for a specific program called ghostscript: def _findGhostscript(): """Find p...
[5 replies] Last: Yes and I believe as a double, triple fallback it has 2 other programs... (by vysero)
namespace without name. I do not understand
 
Why would I write a namespace without name: namespace { double d = 88.22; } And not directly: double d=88.22; Both are considered definitions of global vari...
[7 replies] Last: Okay, I was getting confused by a footnote attached to the section on ... (by closed account z05DSL3A)
by sturk
overloaded function declarations
 
Can someone explain to me why is foo(5,6) wrong and why the rest are correct? I don't understand. Thanks. Given the following overloaded function declarat...
[6 replies] Last: Okay, so it looks like foo(5,6) works because it matches foo(int a,... (by dhayden)
Deletion of a pointer array of parent class (Inheritance)
 
Hello, following is the test program I created. I have tried to dynamically create objects of derived classes of the base class "person" by using a pointer ar...
[3 replies] Last: Any parent class's destructor should be virtual . (If you are using... (by Ganado)
by sturk
Instances of class
 
May I know why's the answer 3 and not all? I guess I do not quite understand. Could someone explain to me? Thanks. Given the following code: template <t...
[6 replies] Last: Is that a standard, to call the value of the pointed variable the “... (by Ganado)
by tanja
Storing class objects in a vector declared in another class is not working
 
Hi, i don't understand what i am doing wrong here. i declared 2 classes A and B. B is supposed to hold a vector of objects of class A. But when i try to add ...
[10 replies] Last: I’ve split keskiverto’s code into 5 files and it compiles and exec... (by Enoizat)
by sturk
Declarations of functions
 
Can someone explain to me why void foo(int a, int b=3,int c) is wrong? and why the correct ones are correct. I don't understand. Thanks! Check all correc...
[1 reply] : Default parameters start from the right most parameter and once you ha... (by jlb)
by sturk
Overloaded operators
 
Can someone explain to me why the codes below give an error? Thanks! Given the following code: #include <iostream> const int & operator+(const int & l...
[2 replies] Last: You cannot change the meaning of operators for built-in types. When ov... (by Peter87)
TIME LIMIT EXCEEDING
 
There is a field with plants — a grid with N rows (numbered 1 through N) and M columns (numbered 1 through M); out of its NM cells, K cells contain plants, wh...
[8 replies] Last: don't know what was thinking the first time, binary search should have... (by ne555)
by kenken
Euler Project # 1
 
Can someone help me see the error in my logic. Problem: Find sum of multiples of 3 and 5 less than 1000. int sum = 0; for(int i = 3; i < 1000; i++) ...
[3 replies] Last: Thanks JLBorges and Repeater! (by kenken)
Strange Exception Throwing
 
Somehow the following code throws an exception: 'Exception thrown at 0x00000000 in GL.2.exe: 0xC0000005: Access violation executing location 0x00000000.' un...
[2 replies] Last: glfwInit() and glewInit() need to be called prior to buffer generati... (by calioranged)
Array Sort
 
/****************************************************************************** Online C Compiler. Code...
[3 replies] Last: what exactly do you want to accomplish? heap is good -- if your stated... (by jonnin)
Why do I get errors when I try to modularize my code?
 
It runs fine when everything is in one file, but when I put the class, header, and driver in different files, I get errors. 11 errors to be exact. The first cod...
[2 replies] Last: When you get multiple errors it's always best to start with the first ... (by Peter87)
Classes in C++
 
Hello, I have a question regarding classes in C++. As far as I've understood the built-in types like char, int, double are not classes. Whereas std::vector, st...
[5 replies] Last: There's some imprecise language being thrown around here, and that can... (by MikeyBoy)
Values of a loop displaying twice?
 
I seem to be having an issue with the values of a loop appearing twice. Here is my code, I am currently coding an inventory program that utilizes vectors. ...
[4 replies] Last: The loop on lines 94-97 are inside the do-while loop so the inventory ... (by Peter87)
by Dee5
Please,can someone hlp me to shorten this code using arrays?
 
#include<iostream> // std, cout, endl #include<fstream> // ifstream #include<cstdlib> // exit() #define FILE_NAME "2018-CSEE-S0800.txt" using names...
[9 replies] Last: This is a good opportunity for you to learn about the standard library... (by JLBorges)
Constructor
 
I am trying to understand what does this line of code means. I know is a constructor but i dont understand what does the second ':' refers to? Any help is gr...
[1 reply] : ... (by Duthomhas)
by arg57
In DisArray over this Array
 
I'm new to this site and have only been learning C++ for a couple months I'm having a problem with the sum function after the for loop 1)In main, create an a...
[4 replies] Last: подскажите литературу для начинающей... (by deleted account xyzzy)
April 2019 Pages: 1... 1516171819... 24
  Archived months: [mar2019] [may2019]

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