Beginners - April 2022 (Page 7)

std::copy results in "Expression cannot seek value-initialized vector iterator"
 
Apologies in advance for the Vehicle class. There's no good reason why it's templated. I was just curious how to create a templated class that can be appended t...
[6 replies] Last: Why not construct v1 direct from v0? #include <iostream> #include <... (by seeplus)
Permutations Assignment Using Double Variables
 
Hi friends! I'm new to C++...in fact, this is my second programming class. I understand a bit of it, but not 100%. My assignment this week is to determine the n...
[3 replies] Last: @j3n1096, You are falling into the trap of seeing a formula involving ... (by lastchance)
cin.fail - how to make it count as one symbol
 
Basically, I am trying to do a very simple ATM. A user can input any symbol on the keyboard, but as int op is an integer, I only want to allow them to inpu...
[6 replies] Last: Or as an alternative, possibly: #include <iostream> #include <strin... (by seeplus)
where should I put my running total ?
 
I cannot figure out where a running total works for my program (new to coding / c++ ) the running total of the user's price, in case they want another oder...
[4 replies] Last: Somewhat simplified: #include <iostream> #include <iomanip> #includ... (by seeplus)
I'm getting one error in my code
 
In the ReadStudents function for "Student Student { _id, c, _fname, _lname, _cname, _Icount };" I'm getting an error for the curly brackets. #include <io...
[1 reply] : When posting code, please use code tags so that the code is readable ... (by seeplus)
Troubleshooting quickSort
 
Hello! I'm writing a program that has two vectors of different class objects. The function I'm having trouble with reads from files into the two vectors and ...
[3 replies] Last: Thank you for the advice, Gando! Your code worked perfectly with the ... (by LioButtons)
2d character array to float and integer array - unexpected float elements
 
I'm hoping to get an answer that doesn't require changing my methods. I'm an electrical student, not software, so I just need to get this to work. I'm reading ...
[10 replies] Last: I should have considered this before posting. Very few people were... (by jonnin)
How can we determine 2D array's column count automatically?
 
Is it possible to write kinda like "strlen(myArray )" inside of right square brackets instead of "200". (In the code example) Code Example #include <io...
[3 replies] Last: Thanks again both of you guys. I'm learning it from udemy course and s... (by bydrachen)
Passing a Char Array's Address Instead of Itself to a Function
 
I recently learned some pointers. And yes, they're confusing. My question is, how can we pass the char array's address to a function. Yes, I can do it with int ...
[11 replies] Last: Thanks both of you guys. Have good day! (by bydrachen)
Why don't use GoTo?
 
Hey! So I made this homework where I should programe my own calculator, in the way I wanted it. It didn't came out the way I wanted it but I had to wrapped i...
[10 replies] Last: Perhaps something like: #include <iostream> #include <string> #incl... (by seeplus)
After deallocating memory, set the pointer to NULL - C
 
Hello, Could you please explain this? I didn't catch it. Why should we set the pointer to NULL after deallocating memory? After deallocating memory, set th...
[3 replies] Last: Null is a special value that we give to pointers to signal that they d... (by Peter87)
by Pen72
Prime number
 
Ugly numbers are those number whose prime factors are 2, 3 or 5. Can you find out those ugly numbers? Specially 1 is considered as an ugly number Input Forma...
[10 replies] Last: #include <iostream> #include <vector> #include <cmath> #include <ioma... (by againtry)
by dune
const pointer
 
I'm trying to get a grasp on const pointer. Given the following code: const int num1{100}; const int* const p_num1 {&num1}; In the second line...
[3 replies] Last: Nicely explained. I appreciate your time, seeplus. Thanks again. (by dune)
April 2022 Pages: 1... 567
  Archived months: [mar2022] [may2022]

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