[go: nahoru, domu]

Beginners

by admin
Welcome -- read before posting!
 
Welcome to the beginner's forum in C++.com! In this forum, users can to talk about any topic related to C++ for non-expert audiences. Feel free to participate...
May 9, 2008 at 10:14am UTC
[2 replies] Last: How To Answer Questions in a Helpful Way Be gentle. Problem-relat... (by admin)
Console Closing Down (1,2,3,4,5,6,7)
 
Hi, i am new to C++ and have just written my "Hello World" program. It worked all right but the console/cmd closes down instantly. If you tell me why it is clos...
Nov 30, 2008 at 3:14am UTC
[120 replies] Last: It displayed "Hello world" after you pressed Enter. int c is a ... (by Duthomhas)
by zzzhhh
It is known that we can't initialize rvalue reference with lvalue, but why can function name?
 
It is said that we can't initialize an rvalue reference with an lvalue. For example: int i=0; int && irr = std::move(i); int && irr2 = irr; In the above code,...
Jul 2, 2024 at 4:41am UTC
[5 replies] Last: And the standard you cited is two floors above: "http://eel.is/c++dra... (by mbozzi)
by zzzhhh
Why is const gone in the return type?
 
template <typename T> const T&& Test(T&& t) { return t; } ...... int i = 0; int&& irr = std::move(i); decltype(Test(irr)) t = i; Since there is a `const` ...
Jun 29, 2024 at 3:12pm UTC
[5 replies] Last: @Peter87: Thank you for referring me to the relevant Standard. I think... (by zzzhhh)
Convert binary to base 58
 
I want to convert a long binary number, 256 bits, into a base 58 char array using c code. I cannot find a simple explanation. The Bing tool insists on convert...
Jun 24, 2024 at 11:55pm UTC
[10 replies] Last: I get the same result on those 2 sites (dcode only accepts decimal inp... (by DizzyDon)
by Ch1156
Best way to modify a variable in a class (1,2,3,4)
 
So whats the best way to modify a variable in a class? Below I have a version that does so through a pointer, but is it better to just make a function that modi...
Jun 23, 2024 at 9:14am UTC
[63 replies] Last: I suggest you look into OOP class design using UML etc. This will give... (by seeplus)
Finding minimum element of a tuple on the basis of first element
 
Hello everyone, I do not know, if it is possible to find the minimum first element in a tuple without using sort function. I have a tuple like this : data=[...
Jun 23, 2024 at 9:11am UTC
[5 replies] Last: I have a tuple like this : data=[ ( 23, a, 3.78, d), ( 11, x, 5.8, w)... (by seeplus)
by zzzhhh
Which ctor of std::unique_ptr is used, when there is a user-defined deleter which is a function?
 
Following is excerpted from section 12.1.5 of text "C++ Primer", which contains text and code constructing `std::unique_ptr` with a user-defined deleter which i...
Jun 20, 2024 at 4:57pm UTC
[1 reply] : The code calls constructor 3 or 4. When the cppreference page writes ... (by Peter87)
txt file to vector giving wrong values
 
I'm loading a txt file into a vector using the code I've written below. It works great except for one BIG issue i'm having. First I'll give a very small exampl...
Jun 19, 2024 at 1:41am UTC
[11 replies] Last: There's a good (and free) set of C++ tutorials and lessons available o... (by George PlusPlus)
by zzzhhh
Why can't assign an overloaded function to std::function?
 
int add(int i, int j) { return i + j; } std::string add(const std::string& s1, const std::string& s2) { return s1 + s2; } ... std::function<int(int, int)>...
Jun 17, 2024 at 11:23pm UTC
[1 reply] : There is a constructor template and a class template in play here, and... (by mbozzi)
C++ Questions (1,2,3,...,10,11,12,13)
 
1) Why does "&myChar " act differently in 2 different contexts? char* pointer = &myChar ; //ALSO WORKS!!! Above, it actually return the address of ...
May 13, 2024 at 3:01pm UTC
[246 replies] Last: I agree with the search fiasco and the current state, but it does leav... (by SubZeroWins)
by Ch1156
When to use const class member variables? (1,2)
 
So while doing something, I made a member of my class const, and i got errors, upon some cursory research I found i need a copy constructor, and to define my ow...
Apr 8, 2024 at 4:52pm UTC
[21 replies] Last: Ok, so its perfectly ok to use static const, and to make it non copyab... (by Ch1156)
lest shift an u8 array
 
Hi. I have an exsiting u8 array in a function (function that get u16 array as argument). How can i create a new u16 array the starts from 3th byte of an existi...
Apr 4, 2024 at 4:47pm UTC
[2 replies] Last: what you had is probably close. remember that c++ starts at zero. th... (by jonnin)
const keyword in function declaration
 
#include <iostream> #include <iomanip> using namespace std; const int NUMCOLS=4; const int TBLlROWS = 3; const int TBL2ROWS = 4; void showArray ( const...
Apr 4, 2024 at 10:43am UTC
[2 replies] Last: thanks buddy (by hassan236)
size_t implicit conversion
 
Greetings! I have a loop that doesn't want to break when it should. for (int i = Xdata.size() - 1; i >= Xdata.size()-B; --i){ // loop body ...
Apr 4, 2024 at 5:04am UTC
[17 replies] Last: I swear I’m getting senile. I'm getting there first. :|... (by George PlusPlus)
operator const char* return (1,2)
 
Hi y'all i was wondering if i can have something like this on one line? return (ss.str().c_str()); or return ((ss.str()).c_str()); operator co...
Mar 28, 2024 at 11:44pm UTC
[39 replies] Last: If I were to start using command-line compilation I would probably go ... (by George PlusPlus)
ASM code and C++
 
Hallo, cplusplus. i am trying to get a bios interrupt call to the bios in c++. but compiling it i get a error.. kernel.c:27:9: warning: implicit declar...
Mar 25, 2024 at 12:51am UTC
[3 replies] Last: OP is clearly not messing with programming on modern systems. Hints: ... (by Duthomhas)
Looking for tutor for OOP class
 
Hi everyone, I dont know if this is the right channel to ask this but im starting to fall behind pretty hard in my OOP class, I really need to catch up on a cou...
Mar 23, 2024 at 4:43pm UTC
[3 replies] Last: I can help you out with what I know currently. Tag me if you are inter... (by CodeChaser)
Launch A Program
 
I'm working on my GUI game framework (SDL, Linux Machine). I have a keyboard shortcut that sends things into edit mode, and I want to have an edit option attach...
Mar 23, 2024 at 4:59am UTC
[3 replies] Last: That's great, thank you. (by newbieg)
How to ensure log folder is created before any log calls are made?
 
The actual code I'm working with is complicated (and something I can't post) so I'm going to use a proxy example. I have a Visual Studio Solution that contain...
Mar 21, 2024 at 2:26pm UTC
[5 replies] Last: Logger.h does serialize writes to the logfile. There is a utility fun... (by kigar64551)
  Archived months: [may2024]