Beginners - June 2022 (Page 2)

Smaller c++ questions (1,2)
 
I am going to be reviewing my C++ from scratch and will have smaller and sillier questions. Instead of making many posts, I will just put them in here as I revi...
[39 replies] Last: [quote=protoseepp]I know that you told me that (begin, begin) & (end, ... (by Peter87)
return type amgiguity
 
I have just been learning about the algorithms in c++ and I am currently looking at 'mismatch' I read that the return type is a pair or iterators with three co...
[2 replies] Last: You are misreading the docs, sorry. https://en.cppreference.com/w/cpp... (by Duthomhas)
Integration between constructor and result of overloaded operator=
 
I have this class template<typename T, typename ... Args> class Function which needs to be declared and initialized this way: Function<int, int> f1('x...
[1 reply] : What is the purpose of the class template? In what context do you inte... (by mbozzi)
issue to appoint two things
 
Wasn't the exact same question in: https://cplusplus.com/forum/beginner/283790/
[1 reply] : A couple of words were changed, making the post even less understandab... (by George P)
alternate input issue
 
Hello everyone, I am very new to coding and am making my through a C++ textbook. I am not a student, I am self-teaching to gain employment in the future. I a...
[8 replies] Last: also very cool that if you multiply 1.0 to the result of two integers ... (by givingitago 88)
Get number of arguments passed to variadic function/method
 
If I have a class like this: template<class T> class Example { private: std::map<char,T> va; public: Example(char var...); } And I wanted al...
[11 replies] Last: @klebermo Your error message comes from this line: f1 = {p5, p6}; ... (by Peter87)
Review / Advice (1,2)
 
Hello everyone. Im a freshman in college taking my first programming class. It teaches c++. One of our final projects (I'm 5 weeks early to make sure I get it r...
[26 replies] Last: One cool aspect of the {fmt} library, as well as C++20's <format>, is ... (by George P)
Question about the move contructor
 
Here is my code, I got instance a, and b created by Move constructor base on a. Class Move has one variable data. I think "move" make b "point to" a, so "a....
[1 reply] : The issue is in main(). &(a.data), &(b.data) is the address of the .da... (by seeplus)
class to aggregate and evaluate many functions in batch
 
I am trying implement a class which should be able to store several functions, like int p1(int x) { return ...; } or int p2(int x, int y) { return ...;} ...
[7 replies] Last: I figured a working example might help. But you're right, it's essenti... (by mbozzi)
'include <cassert>
 
It the header file #include <cassert> still valid in modern c++? I know TDD users assert, but this is a different use. Has c++ moved on and if so what is th...
[6 replies] Last: [quote=Peter87]I guess contracts would have been an alternative. We al... (by George P)
Eigen matrix vs for loop matrix give off results
 
Why is that if I print my matrix inside the for loop gives different results that when I print it outside? #include <cmath> #include<math.h> #include<stdio.h...
[7 replies] Last: dv(j + (ny + 1)*i) oh yeah this is it, I have completely missed this... (by JamieAl)
Need help :)
 
Hey guys good evening. So i've been stuck on this for a bit. The exercise asks me to get 2 answer from a void(). So I tried it doing it with void but I fo...
[11 replies] Last: Code intent should always be clear. What intent can you derive from t... (by George P)
Character Array & Pointer - Confused
 
int main() { char arr = {'F', 'C'}; std::cout << arr+0 << std::endl; // FC std::cout << arr << std::endl; // FC std::cout << &arr << std::...
[3 replies] Last: [quote=salem c]To see the pointer value, you have to cast it to some o... (by Peter87)
How can i change this [Try Catch] C++ code?
 
Hello all im new to this forum and im a C++ beginner too so please forgive me if i did something wrong here.. This is what i want.... If i enter value...
[4 replies] Last: Yea that is exactly what i wanted...Thank you soo much sir i rly appre... (by TharinduCplusPlus)
Optimizing finding the largest element in an array
 
I have written some code that executes fine, but I am looking to further optimize the code with any nuanced methods that I probably haven't learned yet in my cl...
[6 replies] Last: well, you learned something in the class as well. The trick is getting... (by jonnin)
by Rendo
Difficulty understanding for loop iteration results (1,2)
 
Hi, I am extremely new to C++, I apologise in advance if my question is long winded or difficult to follow but here I go. I am reading through a book called C++...
[25 replies] Last: I can't see myself using some sort of object for a local 2 element ar... (by seeplus)
Trying to print one digit at a time using a specific algorithm
 
Im trying to print on digit at a time for example, 123 would be 1 2 3 using an algorithim my proffessor is telling us to use but mines ends up printing 1...
[7 replies] Last: Here is the link for the algorithm OMG - what are they teaching the... (by seeplus)
bug around while(!())
 
there is this bug around while(!()) where i have to re enter my year because it didnt register #include <iostream> using namespace std; int main ()...
[9 replies] Last: Playing around: #include <iostream> #include <string> #include <typ... (by seeplus)
No suitable constructor exists to convert from 'int' to 'Uint64' (user-defined type)
 
I can't compile parts of the SDL 1.2 (here ) with the Visual C++ compiler. In particular, this part (lines 3, 16): // Inside BinaryFile.cpp 1 Uint64 In...
[8 replies] Last: The error messages indeed suggest that Uint64 is being defined as a st... (by Peter87)
by Pen72
Minimal cycle size in graph
 
I got five passed cases and five wrong test cases with the code below, thanks for the help in advance. --------------------------------------------------------...
[6 replies] Last: Yes it works, thank you so much, and thanks for your explanation. (by Pen72)
June 2022 Pages: 12345
  Archived months: [may2022] [jul2022]

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