Beginners - March 2021 (Page 11)

How to check if input is valid, if not reask question.
 
I understand (!cin) but I need to check it for multiple user input variables, how do I do this? And I also don't understand cin clear and ignore, so if the u...
[4 replies] Last: > I understand (!cin) but I need to check it for multiple user input v... (by ne555)
destruct of container
 
#include<iostream> #include<vector> using namespace std; int main(){ vector<int> v1{1,2,3,34,5}; v1.~vector(); return 0; } this prog...
[5 replies] Last: The topic is lifetime of an object and storage duration . See https... (by keskiverto)
about shared_ptr
 
first time to use shared_ptr and wrote the code below. #include <iostream> #include <memory> using namespace std; ​ int main() { int i=19; i...
[4 replies] Last: You would usually use std:make_shared: #include <iostream> #include... (by seeplus)
Homework help
 
I am supposed to write a program that prompts the user to enter the radius of a circle then removes small increments of the circle so it forms a cone and then c...
[2 replies] Last: #include <iostream> #include <cmath> using namespace std; const doub... (by lastchance)
by maple
accessibility about conversion from derived class to base class
 
Hello everyone, I am trying to understand the accessibility of derived class to base class. But it seems confusing. If class Temp publicly inherited from Base,...
[no replies]
by Ch1156
How would I calculate attack hit percentage chance?
 
I'm having a little trouble with figuring out how to go about calculating hit percentage chance for an attack. So lets say I have an attack, and I want it to hi...
[2 replies] Last: Perfect, thank you, I was making it way more complicated than it neede... (by Ch1156)
What is the purpose of template <typename T> in this example?
 
I am reviewing a selection sort algorithm written in C++ and above the functions `template <typename T>` is present. I wonder: What is the purpose of it in this...
[2 replies] Last: Thanks Niccolo! (by cppnewbie10110)
by FORK1
ACCESS attributes to fill MULTIMAP
 
Write your question here. struct source{ string AA BB CC; source(std::string p1="MARK",std::string p2="21 VEGAS", std::string p3="0645454545") : AA(p1), BB...
[19 replies] Last: no no no how i'm i stupid thank you so much ,it was a pleasure (by FORK1)
by maple
confused about move constructor definition in derived class
 
Hello everyone, I am confused about how to define move constructor in derived class. I do not know if it is correct to realize it as below. Since after std::mov...
[9 replies] Last: Thanks a lot @keskiverto. (by maple)
Question
 
You started 3 separate topics, none of which have an actual question or source code you have written. Are you expecting US to to do all the work for you?
[8 replies] Last: The OP was a ridiculous POS so I deleted his account. :-) (by dutch)
no instance of constructor "Persona::Persona " matches the argument list
 
I get this error and i do not know how to fix it: no instance of constructor "Persona::Persona " matches the argument list // Añadir personas al archi...
[4 replies] Last: Note: Lines 8-18 could use C++ Standard Library http://www.cplusplus.c... (by keskiverto)
c++ and SQL
 
Can anyone point me in the right direction on how to combine the codes of c++ and SQL together. I have an idea for an application but I was wondering how the co...
[1 reply] : Here is a link to learn SQL: https://www.w3schools.com/sql/ In orde... (by coder777)
comparing an input value with vector won't work, any work around?
 
Is there a workaround with this? vector <int> size1{ 1,2,3,4,5,6,7,8,9 }; std::cin >> input; if (input == size1) { //cou...
[4 replies] Last: Hello possum swallower, Glad that makes sense. Either method will ac... (by Handy Andy)
by mirjan
Dice game help
 
Hello im a begginer on c++ and i have an exam today :/ Please can you help me on this exam ? Two player game. Player 1 and Megatron (computer) In this game...
[12 replies] Last: What changes introduced in C++14 can potentially break a program writt... (by deleted account xyzzy)
Void Functions
 
I have to use void functions for my class. I'm wondering why my output isn't coming out correctly? I keep getting 75 for each line of output. Your points depend...
[7 replies] Last: I got it. Thanks guys! (by Awak3nDreams)
Struct access private variables
 
I am writing this program to understand the accesses of private variables because i have forgotten how to access them with getters and setters. I don't want the...
[2 replies] Last: #include <iostream> #include <vector> using namespace std; struct S... (by seeplus)
copy constructor, car class
 
Okay so I posted my car.hpp file after the instructions. I have my Person class done and don't need help with that part. I am mostly just confused by 1) the set...
[1 reply] : > 1) the setDriver method, am I getting input from user? I don't under... (by ne555)
Undefined references -Triangle Comparer (1,2)
 
Most of this I have not written. The only part I am supposed to add things to is Triangle_main.cpp, anything under the TODOs are part of my assignment. I am ge...
[33 replies] Last: Oh! I thought you just meant " which clang++ ". Ok, I'll try it. And... (by JRManx)
by qtbit
Summing bits with <bitset>
 
Hello forum. I've been practicing with booleans and operations between them. As you can check the program takes 2 16 bits arrays in input and outputs the sum o...
[15 replies] Last: There are a few, but it's rare. Even if you're pulling bits off a data... (by helios)
Need help reversing a sentence
 
Hello, I'm currently having trouble with an assignment that is due in 50 minutes.. The instructions are to ask the user for a name or phrase then display th...
[2 replies] Last: Thank you! I completely forgot about that (by av16352)
March 2021 Pages: 1... 910111213
  Archived months: [feb2021] [apr2021]

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