Beginners - February 2021 (Page 9)

by amr200
Sorting a stack
 
im trying to sort a stack that has been input by the user. I'm still not very familiar with the sort topic so i don't know what do to at this point. I slowly st...
[9 replies] Last: > from what ive searched so far is that i need to make another stack t... (by JLBorges)
reverse symbols in a file
 
Q: given a txt file, create a new one out of it by reversing the symbols from it and flipping the strings upside down. Ex: (input file) q w e r a s d f z x c v...
[8 replies] Last: Reversing lines and individual elements in a line using std::vector an... (by deleted account xyzzy)
Time Class to Compare Seconds since Noon
 
Hello! Working on a code where we need to create a class TimeDiff that takes Hours/Minutes/Seconds and compares it to the last time the clock struck noon(e.g. 1...
[8 replies] Last: Your bool TimeDiff::validateTime() { return entHour >= 0 && entHour... (by JLBorges)
by hfizz
Lookup table, interpolation, etc. (unsure how to fix errors)
 
I am attempting to extract values from a pre-generated lookup table I have stored in an input data text file in the format of: Particle charge (z) Energy (MeV)...
[15 replies] Last: Hi all, sorry for the delayed response. I've had much work to do over ... (by hfizz)
by bstroe
Mountain
 
I have to determine if the string is mountain. On the first line is N, string size. On the next line are N natural numbers, string elements. Restrictions :...
[10 replies] Last: Based on: -all elements from 1 to i are in strictly ascending order -... (by lastchance)
How to make destructor called
 
I need help with this. Destructor for global and static object are not called #include <iostream> class ConstructorDestructor { public: ConstructorD...
[9 replies] Last: It finally work. For some reason I thinked that when I put breakpoint ... (by d34dc0d3)
Help anyone?
 
Write a program that prompts the user to enter a positive integer between 1 and 1000 (inclusive) and that outputs whether the number is prime. If the number ...
[6 replies] Last: Consider: #include <iostream> int main() { const int primes {2, ... (by seeplus)
by amr200
How to output that the stack is full?
 
i need to make the user input a number then ask if the user wants to input more into the stack and then it'll keep looping until it reaches the limit or when th...
[3 replies] Last: #include<iostream> #include<stack> int main() { const int SIZE { ... (by deleted account xyzzy)
Call a Quote as String
 
Hello! I would like to call a quote symbol as a string, nevertheless looks like the code is wrong for the compiler. Could someone show me my mistake? Below f...
[5 replies] Last: I am reading all, thank you so much Handy Andy and Seeplus. (by DanielDeChamps)
An example of a multithreaded TCP IP server
 
I would like an example of C ++ code for Windows 10, using Visual C ++ 2019 Community, where a TCP IP server accepts connections from many clients simultaneousl...
[1 reply] : I realize I'm about to link to Berkley-style socket functions that are... (by kevinkjt2000)
by bstroe
Little problem
 
#include <iostream> using namespace std; int main() { int a,b,ascend=1,descend=1,mono=1; cin>>a; while (a!=0){ cin>>b; if (b==0) ...
[11 replies] Last: Thanks! (by bstroe)
loop of some type
 
ok so basically I need some help with my schooling. I am creating a simple math equation. however I need a loop or something bc i do believe there is a ...
[5 replies] Last: Here's a variation of Andy's code. I prefer this structure because th... (by dhayden)
SDL Sound stops playing
 
Hi there Working on a simple space shooter and currently implementing sound using the SDL. Got it working but encountered the following problem: I have two so...
[7 replies] Last: I switched to using SDL2_mixer and got it to work. Still would have p... (by theoneandonlyboiler)
by Ch1156
Is there a decent way to make a program delay for a certain amount of time?
 
I have always wondered about how to make a program delay for a certain amount of time with just basic C++ and no external libraries if at all possible, cause i ...
[1 reply] : std::this_thread::sleep_for() (by lastchance)
by kmce
move constructor / move assignment
 
Recently I have been practicing the different types of constructors and assingment operators. I am now doing the move constructor and assignment, and I think I ...
[1 reply] : > Is my move constructor and assignment correct? I am most unsure abou... (by JLBorges)
Code explanation
 
Can someone explain what does this code do and what it will print out on a console? #include <iostream> using namespace std; void rLS (int a , int k, int...
[2 replies] Last: Use "code tags" when posting code: code goes between code tags ... (by dutch)
Makefile not working.
 
I have a Make file listed below with a folder names include that has a single .h file, but the Makefile cannot find it and i am stumped. Can anyone shed some l...
[9 replies] Last: Thank you for all your help. If you have any references on makefile f... (by kingpoop)
Help needed with understanding the code
 
If i put "cout<<a<<"\n";" in the penultimate line instead of "cout<<n<<"\n";", this code prints out 0. Can someone explain why is that so because I hardly get...
[1 reply] : n is counting how many for loops are executed. every loop you make a... (by rozick1)
by bstroe
Monotonous
 
The string of numbers ends with the value 0, where 0 is not part of the heights (only marks the end of the string). Specify whether the range of heights is asc...
[7 replies] Last: There's no need to sort the data or even store all of it. Just keep tr... (by dhayden)
Store Base and Child objects in array without dynamic allocation
 
Hi I have the following code: #include <iostream> using namespace std; class Base { protected: int num = 10; public: int virt...
[4 replies] Last: Polymorphism needs to happen through a reference or pointer. At the ex... (by Ganado)
February 2021 Pages: 1... 789101112
  Archived months: [jan2021] [mar2021]

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