c++ tag

886 questions


1 answers
32 views
0
Why can't I declare a variable in the switch statement?

I thought C++ could declare a variable anywhereWhy can't you declare a variable in the switch statement?switch (val){ case 1: int newVal = 42; break; case 2: break;}

2 years ago

1 answers
86 views
0
I would like to know the difference between 'std::unique_ptr' and 'std::auto_ptr' from C++11. I think the two of you use the same method, but what's the difference exactly?

I would like to know the difference between std::unique_ptr and std::auto_ptr that occurred from C++11. I think the two of you use the same method, but what's the difference exactly?

2 years ago

1 answers
26 views
0
Error creating object: request for member '..' in '..' which is of non-class type

in the classThe one who doesn't get any printsYou have defined a constructor that receives one type of int factor.However, when creating an object in the main function, The constructor (2) that receiv...

c++
2 years ago

1 answers
92 views
0
To call the virtual function of the parent class

In Bar, Foo's virtual void printStuff is overrideI'd like to sing printStuff() of Foo.In Java, we could've used super.printStuff() togetherHow do I use it in C++?class Foo{public: int x; virtual void ...


1 answers
62 views
0
What do you do when you clear spaces in std::string?

What do you do when you clear spaces in std::string?I just change it to a repeating sentence, but I wonder if I can do it without using a repeating sentence like a tupper().

2 years ago

1 answers
24 views
0
Haha... I think it's simple, but why isn't it working?

I'm determined to learn C++, but as in the book example, at least this error appears

c++
2 years ago

1 answers
74 views
0
[C++] I have a simple question

Hello, everyone 1char test = 1;std::cout << test << std::endl;Only the new line comes out Char is 8 bits and int is 32 bits, so I think data corruption occurs.I think it's worth the garbag...

2 years ago

2 answers
83 views
0
How to copy files securely and quickly

I'm looking for a safe and fast way to copy binary/text filesI wonder what other people write besides what I've found so farPlease let me know if there is a problem with my code#include <iostream&g...

2 years ago

2 answers
22 views
0
C++ Copy Generator

#include <iostream>using namespace std;class SoSimple{private: int num;public: SoSimple(int n) : num(n) { cout << New Object : << this << endl; } SoSimple(const SoSimple&...

c++
2 years ago

1 answers
106 views
0
To replace std:string with const char* or char*

Please tell me how to change std::string to const charge* or char*

2 years ago
« - 69 - »

© 2024 OneMinuteCode. All rights reserved.