General C++ Programming - July 2020 (Page 2)

array
#include<iostream> int main(){ int row,question; scanf("%i%i",&row,&question); int a ; for(int i=0;i<row;i++){ int x; scanf("%i",&x); for(...
Jul 24, 2020 at 8:58pm
[3 replies] Last: The stack's memory space is in the magnitude of a few MB. You're tryin... (by Ganado)
by gc2000
Double LinkedList
This is my program but it does not compile can you guys help me, if you need more code let me know I can add it in another comment. iterator.h #ifndef ITER...
Jul 24, 2020 at 7:29pm
[3 replies] Last: After rearranging the code to get everything in the right order in one... (by dhayden)
Creating a very simple bootloader
Hi Guys, I'm following along with - https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf this tutorial/pdf outlines how to make a very simp...
Jul 23, 2020 at 4:37pm
[12 replies] Last: Thanks Helios :) I actually tried adding the optional "0XFF" didn't s... (by adam2016)
When is move assignment/constructor is called
I am trying to understand when is the move constructor assignment is called: #include <string> #include <iostream> struct A { int *number = new int{123...
Jul 23, 2020 at 5:43am
[4 replies] Last: is it copied, or it is optimized right to the function code The only ... (by helios)
Random number doesnt work as "usual"
Hi, i wanna set the range of a random number for myself: int x; do { srand(time(NULL)); cout << " X Wert " << endl; cin >> x; int y = ...
Jul 22, 2020 at 10:09pm
[4 replies] Last: <random> might be better suited to what you are wanting to achieve: ... (by deleted account xyzzy)
How to linearize N-dimensional array index?
I'm trying to implement a simple n-dimensional array / tensor. Right now my class definition looks like this: #include <cstddef> #include <array> t...
Jul 22, 2020 at 4:14pm
[1 reply] : x -> data x,y -> data[x*columns+y] x,y,z -> data[x*columns*height + y... (by ne555)
Encrypted word dictionary with RSA encryption
Hello, I'm all over the place. But I wanted to make an encrypted word dictionary with the RSA system. But I have a problem before generating the word encryption...
Jul 21, 2020 at 5:20pm
[9 replies] Last: I don't know what you are trying to do with the double, but be aware: ... (by jonnin)
Destructor not working
So I'm making a SLL class, however, it appears that I have some memory leaks. Here's the code that's causing problems: // used to detect memory leaks in V...
Jul 21, 2020 at 2:51am
[2 replies] Last: Yeah, just put braces around lines 56 to 59. And if you want to be ab... (by dutch)
How to assign unique ptr?
I was using raw pointers, but I decided to switch over to smart ptrs instead. I've never used them before, so I'm really clueless. So I have a unique ptr lik...
Jul 21, 2020 at 12:18am
[2 replies] Last: How to use std::unique_ptr s: https://www.learncpp.com/cpp-tutorial/1... (by deleted account xyzzy)
insert multiple rows in table
Hi All, In my code, I have a std::list of objects those I need to insert into a oracle table. What I can think now is writing an insert statement in a loo...
Jul 20, 2020 at 3:43pm
[1 reply] : This sounds more like a SQL question, not a C++ question? Correct me i... (by Ganado)
valgrind how to check a pointer without errors
Hello fellow earthlings, I need to check a char array to see if it is valid or not, it could be a nullptr, but not a unsigned pointer, and the safe state is ha...
Jul 20, 2020 at 12:24pm
[6 replies] Last: This is an assignment operator, not a copy constructor. It will be ve... (by doug4)
by ebya
please help me
A) Write a program to automate the billing system for a restaurant. The program should do the following: Show the customer the different items offered by the...
Jul 18, 2020 at 2:47pm
[14 replies] Last: Here's another way of going about it as a start. Maybe you can store t... (by againtry)
Execption thrown when deleting a valid pointer
Hi Fellow Programmers! I am having some trouble with this small project. I am getting a exception thrown at me from "delete_scalar.cpp:Line 34: _free_dbg(bloc...
Jul 18, 2020 at 2:11am
[6 replies] Last: Add the definitions tempMenu(tempMenu const& other) : m_title(new c... (by mbozzi)
cout formatting not working sometimes
Hello fellow stressed out programmers. I'm trying to format my text but it is not working as defined here is example. expected output ***Menu*** 1...
Jul 17, 2020 at 10:27pm
[2 replies] Last: blessings to all Gee, thanks, magic man. (by dutch)
How to test if destructor cleaned memory
hello, I am writing simple handle that stores reference to object in free store. I want to write test to check if after destructor invocation this object is a...
Jul 17, 2020 at 7:02pm
[18 replies] Last: ja, I've got no output running it through valgrind (by ne555)
by GonlyG
Problem with solving Ax+B mod M = 0
I'm given A, B, M and have to solve for x in several equations. My output is constantly incorrect and I can't figure out why. Any help would be appreciated. ...
Jul 17, 2020 at 1:59pm
[7 replies] Last: I checked that gcd(a,m) == 1 ensuring they are coprime... (by GonlyG)
Drawing my axes (1,2)
hello guys, I'm trying to draw my X, Y and Z axes at the top right handside of my screen just like this: https://imgur.com/v6sK2zq, I can draw those axes in th...
Jul 17, 2020 at 12:08pm
[25 replies] Last: @gonado thanks, finally an answer, have you looked at the image I uplo... (by fewdiefie)
by sav44
days of week program (1,2)
Hi everyone. I am in a computer science class and was given the task of writing a code USING ONE DATA MEMBER in order to implement the days of the week (set the...
Jul 16, 2020 at 6:40pm
[29 replies] Last: He's someone who doesn't have the knowledge or skills to backup his f... (by dhayden)
Decorator Pattern
I've implemented a decorator pattern example, but I'm unsure if I have it done correctly. I'm unsure if the destructors are implemented in the right manner. Esp...
Jul 16, 2020 at 11:17am
[5 replies] Last: dhayden wrote: I don't think AddOnDecorator should derive from Bever... (by nuderobmonkey)
by xy06
Please help me with these C++ program questions
Write C++ program to create directed-weighted-graph data structure using adjacency list (use link-list). Insert 1000 vertexes, use random function to insert edg...
Jul 15, 2020 at 3:40pm
[4 replies] Last: Thank you so much!!!!! Appreciate it. (by xy06)
July 2020 Pages: 1234
  Archived months: [jun2020] [aug2020]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.