Beginners - August 2019 (Page 6)

Errors when explicitly deleting move assignment operators
 
Today I came across this code: #include <string> #include <vector> #include <iostream> struct my_type { my_type(std::string name_) ...
[5 replies] Last: @TheToaster, despite the name "std::move", the function doesn't perfor... (by Niccolo)
Binary shift is "too big" but isn’t
 
I’m making a floating_point class and am trying to access the last bit in an unsigned long by masking it by (1 << 64) , but when I compile and run it stops...
[7 replies] Last: Note that numeric_limits<>::digits is the number of non-sign bits in a... (by dhayden)
is there any java part of this forum??????
 
SOS SOS
[1 reply] : No. This is a C++ (and sometimes C) forum pretty exclusively. -Albatr... (by Albatross)
Question about r-value reference with function call
 
I saw the sample code on Stack Overflow. (https://stackoverflow.com/questions/3582001/advantages-of-using-forward) void overloaded_function(const std::st...
[2 replies] Last: > every functions' return value is treated as r-value. Is it correct? ... (by JLBorges)
by Ch1156
Pointers vs references for class objects (1,2,3,4)
 
So in a class using virtual, I see some examples use pointers like so: Weapon *w = new Weapon; Bomb *b = new Bomb; Gun *g = new Gun; w->loadF...
[62 replies] Last: I was just wondering if that was the best way to do it, it seems like ... (by Ch1156)
help with search
 
Hi everybody, I want to print out the qualified items in a vector if a user decides to search for it. Please tell me how to do that?
[2 replies] Last: #include <vector> #include <algorithm> #include <iostream> using name... (by anup30)
string and file
 
Hi! I'm trying to read lines from a text file. The file is like: name1 surname1 number number_1 number_2 .. number_n name2 surname 2 number .. I have to prin...
[6 replies] Last: LearnCpp's tutorial page on std::stringstream : https://www.learncpp... (by George P)
by RicoJ
Making my own iterator: how to convert a non-const iterator to a const-iterator?
 
Hi all, I am trying to implement a custom container and I need to make an iterator for it. I want to squish const iterator and non-const iterator in one clas...
[1 reply] : > I want to squish const iterator and non-const iterator in one class... (by JLBorges)
Shuffle Algorithm for my Poker application
 
I am in doing a school-related project which requires that I incorporate various elements of what we have learned in class, into my project, which is a simple g...
[12 replies] Last: It sucks being a noob at c++. Some of us still are. Self-taught and... (by George P)
vector of unique_ptr
 
I tried to make a vector of unique_ptrs, but here I get a compiler error when I try to dereference the ptr: #include <iostream> #include <memory> #inclu...
[3 replies] Last: Also a quick tip. When making a unique_ptr, you can also use the std::... (by KishoreG)
Tic Tac Toe AI
 
The program just crashes after a couple of go's and i can't figure out why # include <iostream> #include<random> #include <ctime> using namespace std; c...
[4 replies] Last: You have a lot of code that is nearly identical. That's always a good ... (by dhayden)
Debugging in Visual C++
 
I am having a hard time debugging in Visual C++. Most of the time, the element I want to watch is optimized away. I see something happening, but I am unable to ...
[5 replies] Last: Debug code is often a hefty multiplier slower than release code so d... (by Repeater)
Rectangle Sum with array2D
 
I've been giving this code several tries but it keeps crashing. Input 2 integers n,m, and the next n row input m integers each row (in other words, input a 2d...
[5 replies] Last: Pardon me for piling on here, but I'm going to expand on @jonnin's and... (by Niccolo)
Program Is Outputting Data as an int not double?
 
I made a program that converts money from yen, kroner, and/or pounds to USD. However, for some reason it outputs the result as an int rather than double for kro...
[5 replies] Last: Here are some examples of output: Input the balance of money you woul... (by PiggiesGoSqueal)
This has been asked before by others....
 
But it seems I can't apply the solutions given to them for some odd reason. My issue is the age old VS2015 Error C2512: "No appropriate default constructor a...
[19 replies] Last: "Problem Solved." Then please tick the box so the thread is green che... (by George P)
Digit Extraction
 
Can someone help with my digit extraction our Teacher ask us to do like this, WRITE A PRGORAM THAT INPUT 1ST NUMBER AND DISPLAY THE ONES,TENS,HUNDREDS,THOUSAND...
[11 replies] Last: Thank you Sir, @lastchance, i finally submitted to my teacher. (by philipmorries3)
If/Then Statement Issues?
 
I picked up C++ as a beginning programming language after moving on from Scratch a couple of years ago. I've been working on my current project for a little whi...
[6 replies] Last: Do not listen to spam poster, its random text. (by jonnin)
Why does this code not need a move-ctor?
 
My textbook is giving an example of a generic class to store generic objects for a game board without using templates. Here is the abbreviated pseudocode: c...
[1 reply] : the move-constructor does what the author wants (move the vector) the ... (by ne555)
by Ryan15
Counting vowels and storing non-vowels into array
 
I would like to store any non-vowels in notvowel and display them but I'm not sure how to do it. #include <iostream> using namespace std; int mai...
[2 replies] Last: Here is an implementation using a different function with C++17, just ... (by KishoreG)
First letter in string output not showing
 
Hi, i made a simple oop program in which i ask user to input some values and then print them. The problem is, the first letter of the first string is not showin...
[5 replies] Last: Thank you so much Andy, yes putting cin.ignore() after cin>>bookprice ... (by zeplika)
August 2019 Pages: 1... 45678
  Archived months: [jul2019] [sep2019]

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