General C++ Programming - November 2020 (Page 2)

Devide integer in parts
 
How do I make a code where an integer is divided in parts? So if I have an int: for example 605938843, I want as output: 6, 0593, 8843 (parts with length 4). Or...
[7 replies] Last: Another way is to use localizations. Consider: #include <iostream> ... (by seeplus)
How to read multiple text files in c++?
 
This is my code for one file: #include <fstream> #include <string> using namespace std; int main() { fstream file; string word0,word1,word2, filename1; cou...
[1 reply] : #include <iostream> #include <fstream> #include <string> int main() ... (by JLBorges)
Else If just doesn't work.
 
Please see codes below. What an easy concept but I can't get it right. When you type number 1, it outputs English word one. So on. Please help! int main() ...
[3 replies] Last: Yes.... double equal sign, not single. Thank you! (by junweinehc)
How to create an optional for a type with no copy ctor?
 
Hi, I want to create an std::optional for a type that has the copy ctor deleted, like for this type User: struct User { User(const std::string& name, const...
[2 replies] Last: I am using VS 2019 version 16.8.2. The problem must lie in the Visua... (by JUANDENT)
by dman25
Output all IP addresses in network in specific range
 
Does anyone know how you can most easily output all IP addresses of a network in a specific range set by an IP and a subnet mask. Example input: 192.168.15.13 2...
[3 replies] Last: Scan, similar to 'nmap'? https://nmap.org/book/man.html The 'ipcalc'... (by keskiverto)
by Ocko91
cal
 
ok sorry for this long code ... it show me bunch of errors 1>calendarType.obj : error LNK2019: unresolved external symbol "public: class std::basic_st...
[5 replies] Last: @AbstractionAnon, The OP edited their post after our replies, the err... (by deleted account xyzzy)
Help with pointers
 
I got stuck in this assignment. I can't get the for loop to work. The loop needs to step through each character in My_Name and display: the index, the character...
[3 replies] Last: To display an address of type char* using cout, you need to cast the p... (by seeplus)
Pattern mountain (progg. funda)
 
whats wrong with my code?? #include using namespace std; int main() { int n; cin>>n; int i,j; for(i=1;i<=n;i++) { for(j=1;j<=(2*n-1);j++) { ...
[4 replies] Last: #include <iostream> using namespace std; int main() { int n {}; c... (by seeplus)
What Debuggers do you use?
 
Hey everyone! Was curious what debuggers people here use (or whether they use one at all) and why they use them?
[15 replies] Last: "Debugging is twice as hard as writing the code in the first place. T... (by keskiverto)
Need help with some numbers.
 
Hello coders. so I have here a code that works great, but here is a little issue I'm having. When input 123456789 for "Enter price of each copy:" and 50 for "Es...
[4 replies] Last: thank you everyone for your hard work. :D (by Frank5093)
How to create defined users
 
I have a start up menu and I am able to create new users. Right now I cannot login until I create a user. My goal is to have 3 pre made users with balances th...
[2 replies] Last: You're misusing your vector. An object in a vector (account) shouldn'... (by AbstractionAnon)
How does recursion work while defining multidimensional template array?
 
This is the code I found online. template<class T, unsigned ... RestD> struct array; template<class T, unsigned PrimaryD > struct array<T, PrimaryD> { ty...
[6 replies] Last: It is much easier to do "whole-array" operations (the equivalent of Nu... (by lastchance)
How to create a multidimensional array dynamic to the number of dimensions?
 
Let me preface by saying I have extensive experience working with Python. I am looking to build the equivalent of a NumPy array (Python) in C++. My issue is ...
[3 replies] Last: https://www.boost.org/doc/libs/1_73_0/libs/multi_array/doc/user.html#s... (by againtry)
Input to console
 
How can I output vector to the console. How I understand It shouuld be in main(). #include <iostream> #include <string> #include <vector> using namespace std...
[1 reply] : For dealing with struct/class input/output, it's usually easier to cre... (by seeplus)
File editing help! (1,2,3)
 
Hello. I am trying to make a program that edits an .msbt file, which is a file containing a game's text. In this case a file containing unicode char ID's, it'...
[51 replies] Last: Come quickly Lord Jesus! Said the actress to the bishop.... (by againtry)
fast destruction of std::vector<std::pair<int, int> > (1,2)
 
Dear C++ experts I applogize for my frequent similar submissions, but I am really in trouble. I am bothered by high overhead of destruction of STL container l...
[27 replies] Last: Finally, I could resolve a series of my problem relating to memory all... (by Mitsuru)
Memory location of return values of functions, relating to functional programming
 
Dear experts I sometimes wonder how Memory location of return values of functions is handled. This question is mainly because some techniques in functional p...
[2 replies] Last: Dear mbozzi I am going to use functional programming techniques in t... (by Mitsuru)
OOP communication protocol class
 
Hi I want to create a class A that contains a communication protocol for a RS232 interface. Furthermore I want to create a class B that use the communication...
[5 replies] Last: yes, you understood it. Client server may not need that registration... (by jonnin)
Is a number prime
 
Hello I got a task, and I don't have any idea how to do it. Maybe you can help me? There is given a whole number (that you need to insert by yourself using t...
[11 replies] Last: for (int i = 3; i * i <= a; i+=2) // <-- (by againtry)
Getting the position of a element
 
How can i check if the position of an element in a one-dimensional array(vector) is odd or even? can i get an example :)
[7 replies] Last: [quote=corepower]i solved the previous question That's stretching it ... (by lastchance)
November 2020 Pages: 1234... 7
  Archived months: [oct2020] [dec2020]

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