c++ tag

886 questions


1 answers
124 views
0
Is it possible to input/output a C++ file through a variable in which the file name is stored instead of entering a specific file name?

I'm a C++ beginner. Hello.Not the same format as ifstream in (C:\~~~~~\Example.txt).Stored as string A = Example.txt, I wonder if there is a way to write in the same format as ifstream in (C:\~~~~\A)....

2 years ago

1 answers
110 views
0
Shallow copy process of C++ copy constructor?

//#include stdafx.h#include <iostream>using namespace std;class MyClass{public: MyClass() { pnumber = new int(5); } ~MyClass() { delete pnumber; } int number = 0; int *pnumber = nullptr;};int ...

2 years ago

1 answers
146 views
0
How do I truncate a string in C++?

In Java, we could've used the bottom togetherIs there an easy way to do it in C++?String str = The quick brown fox;String[] results = str.split( );

2 years ago

1 answers
111 views
0
Why is C++ slower to read than Python?

I ran a program that receives a line from stdin in Python and c++C++ is much slower.Isn't Python usually much slower?Is it because I made the code weird?I don't know what's wrongI ran it on OS X (10.6...


1 answers
65 views
0
Can I use "delete this"?

Can I write delete this; when I delete an instance of the class I created with new at the end?Write it like this. void doStuff(){ // This object is a working module // When you want to switch to anoth...


1 answers
102 views
0
I want to print out the type of variable.

In c++, how do you output a variable type?I checked it using type() in Python, but I am asking because I think there will be such a method in C++. What is the function that functions typeof(a) in the ...

2 years ago

2 answers
24 views
0
C++ real number, integer speed difference

When using the same algorithm in C++, does the operation show a significant difference depending on whether it is a real or integer operation?For example, if you find the area of a circle in a loop 10...

c++
2 years ago

1 answers
129 views
0
I am curious about the principle of variable in c++ boost library.

Hello, I'm a student studying c++.++.In my project, I need a class with functions similar to the variable in boost.However, the cost is too high to add boost, so I tried to implement it myself, althou...

2 years ago

1 answers
50 views
0
[C++] Call-by-reference question.

#include <iostream>using namespace std;void Plus(int * num){ ++*num;}void reverse(int * num){ *num *= -1;}int main(){ int num = 10; int num1 = -9; Plus(&num); Plus(&num); Plus(&num);...

c++
2 years ago

1 answers
24 views
0
Modifying program C to Python.

Modifying program C to Python.The c program I want to get first is :#include <stdio.h>void main() { int i, j, count = 1; long sum = 0; printf(Program \n) to obtain a decimal number between 1 and...

2 years ago
« - 71 - »

© 2024 OneMinuteCode. All rights reserved.