Beginners - September 2021 (Page 4)

I don't know why this does not run successfully.
 
My code is to determine weather a person is available by his/her age. 6<=age<=10 means qualified. But no matter what number is input, output always is true. ...
[8 replies] Last: sorry for that, I copy/pasted the bad condition without noting :( (by jonnin)
I am losing my mind
 
This is so basic yet i cant seem to get it and it is frustrating me Basically I need to input the world population and country population, and get what percenta...
[3 replies] Last: #include <iostream> int main() { long long int worldPop {}, countr... (by seeplus)
by jonnin
21312
 
set up a boolean, eg bool isvalid{true}; //until proven otherwise, the value is valid.. then loop until happy: do isvalid = true; //reset it each loop! read a n...
[3 replies] Last: The question was essentially, "How do I handle user input during an in... (by mbozzi)
Mismatched file types for std::getline
 
I'm trying some basic C++ file stuff. I've created a small class with some functions to help read sections from a file. The important function in the class is t...
[7 replies] Last: The default delim for .getline() is '\n' - same as for the standalone ... (by seeplus)
by Milnk
How to add input string at the final output
 
If my input is 10 4 | - It should print out |----|----|----|----|----|----|----|----|----|----| But my code only prints out |----|----|----|----|----|----...
[14 replies] Last: Yeah - using s for string requires using namespace std::string_literal... (by seeplus)
bool function checks and returns if the (sub) trees are completely identical
 
Im trying to create a bool function : The function checks and returns if the (sub) trees are completely identical. Ie. that both trees have exactly the same str...
[4 replies] Last: the feedback seems picky... the best way to do this seems like setting... (by jonnin)
by nosol6
Dynamic Array Allocating Function
 
I'm currently in the process of writing up a function that allocates two arrays of 100 integers each using this function. The function has 2 arguments: 1)...
[2 replies] Last: @nosol6 In your first snippet, line 15 works, but would more normally... (by MikeyBoy)
DO WHILE LOOP C++
 
CAN I ASK FOR YOUR CODE ON THIS, THAT THE OUTPUT MUST BE Enter how may number:5 10 5 100 4 56 Number/s ends with zero: 10 100
[8 replies] Last: #include <iostream> #include <string> using namespace std; int main(... (by lastchance)
if two trees are identical
 
Why we pass two parameters/pointers in bool function when we want to create function to identify if two trees are identical ? and when we call this function in...
[10 replies] Last: You're welcome friend ;) (by malibor)
if two trees are identical
 
Why we pass two parameters/pointers in bool function when we want to create function to identify if two trees are identical ? and when we call this function in...
[1 reply] : Please try to make just one thread in the future: http://www.cplusplus... (by malibor)
by alexas
cuboid chain rotation - reversed case
 
I have a chain of cuboids. Every cube's new position is based on the previous cube. The cubes are rotated relative to ABSOLUTE space using axis-angle notion. ...
[7 replies] Last: Thank you very much. (by alexas)
null pointer declaration throwing errors c4430, c2061, c2143, c2238
 
I keep getting a build error when trying to declare a pointer in a class I created, can someone tell me what I'm doing wrong? Here's the class that needs to de...
[2 replies] Last: wow. Thanks for the help--I took the #include "NPC.h" from the localMa... (by trenidor)
Removing the last period or decimal after the final number
 
Hi, we've been tasked to make a program that will print the first and final input from the user with period or decimal between each number. However I need to re...
[8 replies] Last: Thanks to everybody! I am learning so much from you guys and because o... (by noir234)
fork () function | system calls
 
Here is fork function, (linux system call) I dont actually understand why it looks like this and what is getpid, pid , if someone can help, kindly explain thi...
[2 replies] Last: Forking isn't too hard, but you need to read the man page through a fe... (by Duthomhas)
by LeoV3
How to solve repeatedly squared math problem?
 
Given real numbers x,a, and natural number n. Calculate the expression as shown on the image(https://i.ibb.co/N2PFhYL/2021-09-17-003451.png): ((...((x+a)^2+a)^2...
[19 replies] Last: #include <iostream> using namespace std; int main(){ unsigned x=2, ... (by anup30)
by FayZ
malloc: error for object: pointer being freed not allocated
 
I've created a member function that can merge two sorted linked lists. I'm fairly confident that it does the job, I used a while loop inside the function to dis...
[5 replies] Last: You haven't provided the declaration for your List class. Line 2: One... (by AbstractionAnon)
by PK Dey
Why the following code shows error?
 
Why the following code showing error? #include <iostream> #include <cstring> #include <conio.h> using namespace std; class rangpur { public: char message ...
[5 replies] Last: Within a class, the size of arrays have to be stated. is not allowed... (by seeplus)
Matrix Generation by assigning random values to the given index
 
Hello everyone , I need your help and I will be very happy if you can help me. I need to generate a matrice like M= . I have another two arrays which show...
[5 replies] Last: Thank you so much @lastchance and @jonnin. Your explanations and examp... (by learner999)
by PK Dey
Why the following code shows error?
 
Why the following code shows error? #include <iostream> using namespace std; class student { public: int id; double gpa; ...
[2 replies] Last: Thanks! (by PK Dey)
The delete reserved word from library<new>
 
I deleted explicitly the array texts, but even after that, I can still access to its values. it doesn’t make sense to me, may someone please explain me?? ...
[1 reply] : The memory block is "returned to the heap". The data in the block isn'... (by kbw)
September 2021 Pages: 1234567
  Archived months: [aug2021] [oct2021]

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