Beginners - August 2020 (Page 3)

Toys & DS - a fun DSA questions
 
Little Axel has N toys numbered from 1 to N. Each toy has two properties: Ei—enjoyment, which is the number of minutes Axel can play with toy number i with...
[1 reply] : https://www.cplusplus.com/forum/beginner/272345/ You're never going t... (by salem c)
Palindrome Count (1,2)
 
A contest closes in n days hh hours, mm minutes and ss seconds. Given two values of n, how many palindromes of the format nhhmmss would we find in the indicated...
[21 replies] Last: @againtry, thanks a lot and everyone who helped me out there. I am stu... (by shrutichandel)
by jerryd
Count the files in a folder
 
cplusplus forum, windows 7 MS VS 2017 C++ Is there some code I can write to get a count of the number of files in a folder? Jerryd
[4 replies] Last: Hello otherwise you can do everything with <windows.h> as I started to... (by Huntercori)
Stupid compiler rules
 
Beginner question. I wanted to make a very simple function that checked whether a pointer (freshly allocated) was null or not. If null, shut down with a message...
[6 replies] Last: https://en.cppreference.com/w/cpp/memory/new/nothrow (by againtry)
Got Something to Work and Not sure why its working
 
So i made a mistake in my code, but it did what i wanted it to do. But strangely i don't see the logic of how its working, in fact i would think it should have ...
[3 replies] Last: Problem solved by the look of it. Note also that the <string> class ha... (by againtry)
Double, Float or other issue?
 
I have some code with the following parameters required... u = 1e-08 dr = 0.00673332 mo = 1 - u mo = u mo = -u mo = 1 - u p = -((1 - u) + dr) ...
[10 replies] Last: Let's see: #include <iostream> #include <iomanip> using namespace std... (by lastchance)
Making my own heap allocation with buckets.
 
I did an exercise and I would like for it to be checked if done correctly. Here is the exercise: Create a LargeBucket class that can store up to 1MB of dat...
[8 replies] Last: Yeah I am over thinking it. I understand what need to be done now. Tha... (by closed account 26q2b7Xj)
auto keyword type is not recognized in my pc
 
with the given code, my compiler does give an error saying that x has no type defined. void printGraph(vector<int> adj , int V) { for (int v = 0; v...
[4 replies] Last: An array of vectors. Creating and passing a 2D vector might have been... (by George P)
arrays
 
hey lads, I was trying to write a code which will create an array with random integer values, and the number of elements in array should be inserted by the use...
[5 replies] Last: it asked you to count the ordering (sort). You counted the copy.... ... (by jonnin)
trouble following psedocode
 
I'm doing a lesson for random access with files. They gave this pseudocode Write a program that reads each line in a file, reverses its characters, and wri...
[4 replies] Last: #include <iostream> #include <string> #include <fstream> int main() ... (by againtry)
An aligned memory storage to load a file?
 
I need to pass a font that is loaded to the memory from a file with fstream into a FT library function. It needs to be the base char pointer. Now after some rea...
[2 replies] Last: After further investigation I've found that I don't need to do alignin... (by oleksijp)
How to create a new page on files
 
Hi guys, I had a question about files. I wanted to know how to command the text to be outputted on a separate page in the "file.doc" file after each iterati...
[3 replies] Last: Sounds great thank you all for your help. I was able to figure it out... (by kdrewes)
Creating a Vector of Strings
 
Hi, I was trying to create a vector of strings with size 100 using the following code: vector<string> arr(100); However, this line gives me an error - e...
[10 replies] Last: @viraamrao For a good start on this and other "(STL) containers" you c... (by againtry)
reading bytes from a file
 
I have another online "fill in the ..." programming example i'm having trouble with. It has to do with reading binary files and this is the first problem they g...
[7 replies] Last: quite confused by this whole mess. @OP: your two code snips are too s... (by ne555)
Fill The Cube
 
A company manufactures walls which can be directly implanted at the site. The company uses small square bricks of material C and material D which have similar l...
[15 replies] Last: @lastchance PS There was no melt on the second transform of mine origi... (by againtry)
by Ganado
Option to warn on comma typo/string concatenation
 
In the following code, there is a subtle bug because the first entry of the array is missing a comma, so the string literals get implicitly concatenated togethe...
[2 replies] Last: Thanks mbozzi, I'll try it out. (by Ganado)
Operator<< can't access member variable outside of .h header.
 
I am having trouble understanding why VS won't let me access the Vector's private member of m_gabes_vector in my .cpp file. In my Vector.h I have: friend std::...
[6 replies] Last: Yeah thanks! (by closed account 26q2b7Xj)
by Mif
Need help with some loops..
 
Ok.. this is a piece of code where the user input an array of numbers, then user choose its elements, and finally the average of those elements. I want the prog...
[6 replies] Last: printf("\n\tElement %d = %d\n", k, mark ); //is this what you want?... (by jonnin)
Dobubly Linked List Adding Default Entries Upon Execution
 
Hi, I have a program to model a small music database. It uses a doubly linked list to model the 'SongList', but my issue is that it seems to add two nodes of da...
[3 replies] Last: If you want to do it linear and with `head' and `tail' pointers, then ... (by ne555)
pass arguments from functions to functions
 
Hi can you help me, I would like to be able to sort file extensions, dates, file size from the main function. Is it ok if I send the arguments to the find_file ...
[9 replies] Last: I removed the & and I put the {} missing for some loops, for most exte... (by Huntercori)
August 2020 Pages: 12345... 8
  Archived months: [jul2020] [sep2020]

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