Beginners - May 2019 (Page 8)

by Pecvx
Regarding exception handling
 
Hello, is there any differences with putting the return statement outside of the try-block(like here), or as the last element within the try block? marked wi...
[1 reply] : Hello Pecvx, I would say yes. When you look at the structure of the f... (by Handy Andy)
writing to a text file
 
I am trying to write to a .txt file lyingon my desktop but it is not working. If anyone can help me out. The code is as below. #include<iostream> #include<f...
[13 replies] Last: Hello Beginner of C, The following program illustrates a different, I... (by Handy Andy)
Why does my program end when it's in the second loop of try catch?
 
So here's how the error occurs, first I type in 2.2 or any error that is not accepted by my try catch, I get prompted with the error message and it continues ...
[7 replies] Last: Hello mrtammy2008, @mbozzi @ne555 , sorry I don't understand anythin... (by Handy Andy)
Approach for the question
 
You are given an integer array A of size N. XOR power of any subarray of array A is defined as the xor of all the integers in that subarray. Your task is to fin...
[1 reply] : You know, you’re turning into a real spammer with these competition ... (by Duthomhas)
Making decimal points lined up
 
Hey guys! I'm trying to line up the decimal point results at the end. Also I'm trying to figure out how to line up the question and numbers when asking for the ...
[8 replies] Last: std::put_money method (works well only if the locale of interest is ... (by JLBorges)
by sturk
C++ virtual inheritance memory layout
 
Hi, I am trying to figure out why _vptr$Grandparent & grandparent_data occupy the last memory in class child's memory layout although it is top in hiearchy? Sti...
[1 reply] : Why do you want to know (or care)? It is (at best) a peculiarity of y... (by salem c)
Adding external library
 
Hello everyone, I want to add an external library into my c++ program(I use Dev c++ IDE).I have both the header and source file for the library. Where shou...
[1 reply] : read a tutorial for the specific library, youtube or a wiki, a tutoria... (by poteto)
Sending function call operator to template
 
Hi! Building a simple multithreaded client/server program and i'm using a threadpool to handle the connections as they get accepted. I have the following code (...
[4 replies] Last: Ok, some advice ;) First, are you still doing this: ThreadPool thre... (by Niccolo)
Open a screen , draw a line with mouse
 
Hi, What code do I need to open a blank screen ? (On that screen, I want to draw, when I will move my mouse. )
[14 replies] Last: @lastchance O -- nice :) Now... as an exercise only, please select ... (by MikeStgt)
Solution needed
 
https://www.hackerearth.com/challenges/competitive/Increff-CodeRunner-Contest/algorithm/magic-of-square-dd192013/ Getting TLE in my approach can someone give...
[3 replies] Last: Duplicate "do all the work for me" post: http://www.cplusplus.com/foru... (by George P)
Please help
 
https://www.hackerearth.com/challenges/competitive/Increff-CodeRunner-Contest/algorithm/bob-and-bombs-1-72cb4c59/ can someone give me solution to this question
[2 replies] Last: Duplicate "do all the work for me" post: http://www.cplusplus.com/foru... (by George P)
How to make arrays work when "Expression must have a constant value." keeps showing up
 
"Expression must have a constant value." appears four times in the error list and are the only errors. They appear for lines 39 and 51. I've gone to stock overf...
[8 replies] Last: I don't think that the arrays need to be changed to vectors since the... (by Peter87)
Ascending Sort
 
I am trying to create a function that will reorganize an array of ints in ascending order by doing it recursively. The program stalls with a blinking cursor and...
[10 replies] Last: Thank jonnin! I appreciate all the info. I'll keep that one in my back... (by stoneJax)
by sturk
Memory layout of derived class
 
Why is there a vptr:void* in the memory layout of class itemtobuy. Is the class virtual? Is it becoz of the virtual destructor? class Item { long long ...
[2 replies] Last: I'm not a compiler writer, but removing virtual from the subclass dest... (by Ganado)
Why is my bool function returning 12 and 24 (but only when called upon by another function)?
 
I'm trying to make an iterated prisoner's dilemma tournament to get more familiar with classes in C++. There are various classes that act as bots that interact ...
[2 replies] Last: fight() takes p1 and p2 by value, but to use polymorphism you have to ... (by helios)
Need help understanding bool
 
I was working on some exercises from class until I got stuck on a question and decided to have a look at the answer. This was the solution. int position(...
[6 replies] Last: The name "found" was clearly chosen to express what the variable repre... (by keskiverto)
Clear Buffer
 
Hello, I'm trying to prevent error from user input but when i check if the values are compatible into the if statement it always accept it as compatible type...
[2 replies] Last: #include <iostream> #include <cctype> bool answer_is_yes_to( const c... (by JLBorges)
Sieve of Eratosthenes defective
 
Dunning notice to beginners about a trap (I found again, unwittingly). Not the Sieve of Eratosthenes is incorrect, it's my migration from REXX to C++ here htt...
[no replies]
by ICantC
smart pointer linked list - leak free?
 
I'm new to templates and smart pointers, I'm wondering if the below is pretty much a leak free implementation? Obviously it lacks functionality, and i'm assumin...
[3 replies] Last: Your initial theory is correct. If you delete the first node, that wi... (by Niccolo)
by wuwy
How to count how many times unique word appears
 
For one part of exercise I need to count how many areas there are: 15 Vilnius Vilniaus 541278 Dusetos Utenos 4211 Aly...
[3 replies] Last: if you need to count "how many times a unique word appears" then use <... (by anup30)
May 2019 Pages: 1... 678910... 16
  Archived months: [apr2019] [jun2019]

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