Beginners - July 2021 (Page 5)

How to extract the n-th dimension of a multidimensional array?
 
Let's say I have a multidimensional array, for instance: unsigned short arr ; How can I extract the n-th dimension of that array? Something like arr...
[2 replies] Last: There is std::rank which returns the number of dimensions and std::ext... (by seeplus)
C++ pointer and struct
 
Hi all, I am a Computer Science student who just started C++. I am on struct right now. I got an error message but I don't have any idea.. It says "segmentation...
[3 replies] Last: Thank you so much, I changed the code according to your advice. It see... (by dntwk707)
12 Hour Clock Displays Incorrectly after 11:59:59
 
I have program that outputs a 12 & 24 hour Clock side by side with a users options menu to allow user to add an hour, a minute, and a second to both clocks. The...
[7 replies] Last: Driving home Dutch's point, if you record the seconds since midnight t... (by dhayden)
How to deal with frustration?
 
Salutations all, as you could tell by the title of this topic, I'd like some advice on how to deal with the frustration of not understanding certain concepts or...
[12 replies] Last: @OP, to me it sounds you want to learn too many different things at o... (by thmm)
asm to c++? (1,2)
 
I have this code in asm that I'm debugging: //no type checking here. mov ebx, dword ptr ds: //a string from user input movsx edx, byte ptr ds:[eax+40341E] /...
[37 replies] Last: Thank you, that explanation is very clear. (by Banzuki)
can anyone help? I need ASAP.
 
#include<iostream> #include<iomanip> #include<cmath> using namespace std; using std::setw; using std::right; int calPayment(char service, int duration) { ...
[4 replies] Last: I see you haven't fixed line 39 as I pointed out in my forum reply. L... (by AbstractionAnon)
Where did i do wrong?
 
So im trying to get better in this thing but i dunno what i did wrong, it lets me write in the firts cin part but when it gets to the getline part it dosnt work...
[2 replies] Last: When you as user type the number, you do type 'Enter' too, don't you? ... (by keskiverto)
getline not working for converting a string to a vector array
 
I am trying to convert a string from getline into a char vector but the size is 0. I am sure that I am inputting the word test into the terminal correctly. I...
[2 replies] Last: What comes BEFORE the snippet of code you have shown? Show COMPLETE, ... (by lastchance)
Access typedefs of template class without template parameters?
 
Hi I have something like the below code: #include <iostream> using namespace std; template <typename T> class Something { private: public: ...
[1 reply] : Something I like to do especially if the template arguments are compli... (by AbstractionAnon)
C++ - Access to private member from inherited class
 
Hello, I have two classes, Person and Student. Person class: int id; string name; int age; void set_id(int); int get_id(); void setname(string);...
[3 replies] Last: So make age protected. class person { private: int id {}; string n... (by AbstractionAnon)
by Hyung
How to compare value in a file with many row ?
 
I have a file that has 3 columns with many rows. I want to compare the value either increase or decrease for a column. But when I compare, the value always incr...
[2 replies] Last: Hello Hyung, Watch your indentation. Not only is what you post poor i... (by Handy Andy)
struct within class template - linked list
 
Hello, I am making a linked list and using a class template, and within the class I have a struct for the node. But I am having problems creating the functions ...
[9 replies] Last: OP's mistake seems to be that the template is implemented in a separat... (by mbozzi)
Force C++ to move out of an object when invoking external C function that takes object by value
 
I have a C function in a DLL that takes an object by value. I am trying to generate C++11 bindings for the DLL. In C, everything works normally: typedef s...
[4 replies] Last: The implicit object parameter of a member function that moves from *t... (by mbozzi)
Constructors and classes
 
This is a simple program describing two classes- a point and a vector using the point as datatype. I am also trying to use constructors in class point. But when...
[4 replies] Last: On the first post replace line 14 with point start{0.0, 0.0}, end{0.0... (by thmm)
class template question?
 
I am reading a book and it gives an example of a class template, but doesnt talk it through, so hoping someone can clarify something. The place i am confused in...
[5 replies] Last: Based upon original code, consider: #include <iostream> #include <v... (by seeplus)
Basic VM code wont compile
 
I am building a basic VM and my code will not compile, get the error "In file included from Main.cpp:2: Instruction.hpp:15:2: error: expected ‘;’ after c...
[5 replies] Last: Seems fine on clang as C++14 and 17. One thing ... If you're using <c... (by kbw)
Create and array with random numbers and strings
 
How do I create an array with random numbers and strings? sample output is: 100001, wtfxltnqbkviye, zhajstwyxcaptn, 9572, 52173, 123, 25908 0 92106 77831 41707...
[11 replies] Last: One way to produce the random data and the top 5 high and bottom 5 tot... (by seeplus)
How do I make a line?
 
How do I make a line? I cannot wrap my head around the "setfill()" function. I just want to make one line, not fill the whole output with '_' cout <...
[3 replies] Last: Thank you! All I could find online was crazy functions or graphics to... (by Fayezilla)
why dosnt it print the backslash
 
well im trying to build a street with code and im very new but why dosnt it print the backslashes, it always gives me only the left side yk. #include <iost...
[1 reply] : You need a doubl backslash in the code to output a single backslash. S... (by coder777)
Help me
 
so im very new to this stuff but that \n should put it in the next line and all but if i write this the endl isnt working, its not green like normal but blue li...
[1 reply] : You need to add another backslash to the last backslash then in should... (by coder777)
July 2021 Pages: 1... 34567
  Archived months: [jun2021] [aug2021]

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