Beginners - June 2021 (Page 4)

Any comments on my program?
 
I wrote a complete C++ program that will ask the user to enter a number between 1 and 3. The program will then generate a random number between 1 and 3. The num...
[4 replies] Last: Okay, I appreciate the comments, I made changes to my program and It's... (by BlueCOCO1)
by chipp
std::size() and sizeof()
 
i wanna ask, why std::size() and sizeof() results for array is different while std::size() is said as sizeof()'s replacement..? e.g.: std::array <int, 3>...
[7 replies] Last: ok, thanks for the answers, guys... i'll call it done, then... (by chipp)
Confused on how to declare formulas
 
Given two integers, say a and b, the maximum and minimum can be determined with the following formulas: max⁡〖= (a+b+ |a-b|)/2〗, min⁡〖= (a+b-|a-b|)/2...
[3 replies] Last: #include <iostream> #include <cmath> using namespace std; int main()... (by lastchance)
Drawing Multiple Items in OpenGL
 
I am trying to draw multiple items in a Scene in OpenGL. I've set the model matrix, but I'm confused as what to do next. I don't know what next. If someone can ...
[no replies]
by hbcpp
no type named ‘iterator_category’ in ‘struct std::iterator_traits<std::__cxx11::basic_string<char> >’
 
Environment: Linux Mint 20.1, Code::Blocks, gcc 10.3.0 I am trying to copy files with some copy_options included but as soon as I include one the compiler thro...
[2 replies] Last: Should it be fs::copy ? Oh that solved the problem. Thank you.... (by hbcpp)
pointer to pointer , confusion
 
below code -> ent is a class , modulebase is of type uintptr_t. i understand whats happening here ent* localplayer = (ent*)*(uintptr_t*)(modulebase+0x67690...
[1 reply] : In both cases, you're: - generating a temporary pointer of type uint... (by MikeyBoy)
by saam
Implementation
 
Write a pseudocode function called RecursiveFind, which is a recursive implementation of the function Find: it should take the same inputs as Find in addition t...
[6 replies] Last: @seeplus thanks for the help (by saam)
Best practice for a class member that is the product of 2 other class members
 
Hi, let's say I have a class that uses a rectangle's area, but the user cannot set the area as a setter, it needs to be calculated internally from a height and ...
[4 replies] Last: > As rectangle is using exceptions, wouldn't main() have a try/catch c... (by JLBorges)
Ray and Plane Intersection
 
I have an assingment due for my College program I'm in, and I'm stuck on getting the answers. This is the info I have. Ray Start = 1,0,1 Ray Dir = 3,2,1 Plane...
[18 replies] Last: Look at the routine Plane::intersectionPlane It already writes informa... (by lastchance)
by CVRIV
Question about header files and adding additional cpp source files. (1,2)
 
So im writing a program and it's getting annoyingly large in size where im having to scroll through lines and lines of code to get anywhere. Its time for me to ...
[32 replies] Last: > add the directory containing headers to the compiler's include path ... (by JLBorges)
Trying to make it where it's invalid if a user enters a nonnumeric input and starts from the beginning
 
I tried to input it and I almost got it but I feel like there is on small change. At the end each time, the message asked me to input a number value no matter w...
[3 replies] Last: Hello digitalFun157, I take a different approach with your program an... (by Handy Andy)
Calculate electric bill
 
Write down a program to calculate the fees charged on the house entered. The charge for 1 unit of electricity is RM 0.05. A value of 999 is entered to dismiss ...
[5 replies] Last: ok thank you guys, your coding really help me with an idea. I have com... (by Nik Hazreen)
by Ch1156
Nesting classes?
 
I want to be able to nest a class within a class or a struct within a struct. The reason for doing so is that if i have a class, I usually like to have function...
[11 replies] Last: And thanks for the good examples as well. I have always just put tho... (by jonnin)
by peza
How to show output of linked list after getting user input
 
Good day, I'm quite new to linked lists, and I would like to ask for help with completing my code, I'm not sure how I'm going to display the output of my progra...
[1 reply] : You aren't linking the nodes together. It's this linking of nodes that... (by seeplus)
Having a problem with functions, function not working
 
Hi,i'm supposed to write an input function which ask the user to input a char. This is my first time using functions, and my function doesn't display anything w...
[4 replies] Last: [Continued here http://www.cplusplus.com/forum/beginner/278694/ ] (by seeplus)
Writing function and combining them in the main loop of options
 
Hi, so i'm supposed to write functions: input, distance and display function and then combine them in the main loop of options. I wrote the functions and tried ...
[6 replies] Last: As a first revision, perhaps consider: #include <iostream> #include... (by seeplus)
Is program correct?
 
I created a program and want to make sure it's correct. The original prompt is :Write a program called Lab11.cpp that reads a Fahrenheit degree as an input from...
[1 reply] : Is program correct? Functionally the program is correct, though I'd ... (by deleted account xyzzy)
Problem with cout with multiple namespaces.
 
I am trying to practice using namespaces that each have a class of the same name. I tried to create two constant integers of the same name and print the one in ...
[7 replies] Last: Thank you both. (by BroBuilder)
by kollim
srand() working
 
Why does this generate the same random number each time ?? As far as I understand srand(time(0)) tells the random number generator rand() to start with a ne...
[7 replies] Last: Hello kollim, This video is worth watching: https://channel9.msdn.co... (by Handy Andy)
reading register values from c++
 
Any ways of reading the register values while debugging . for example if i would like to put an condition like 'if(eax == 100)' in the below code before Nop fun...
[1 reply] : For the first question, kind of. If you mean to actually use a debugg... (by newbieg)
June 2021 Pages: 123456... 9
  Archived months: [may2021] [jul2021]

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