Beginners - October 2019 (Page 4)

Unique random integers (1,2)
 
Is there a way to generate unique random numbers using the <random> header? int a = std::uniquePRNG();
[20 replies] Last: I would be surprised if any implementations existed that didn’t use... (by George P)
password with mixed upper & lower case & special characters/ password lenght is mini 8
 
Write your question here. hi, i'm a beginner from the root of the tree, and i cannot solve this project for days now, help is needed. when i compile, the msg <...
[4 replies] Last: ok. Whether you do it all in one as I did or not you still need to f... (by jonnin)
structure initialization question
 
Hi guys. Imagine you have the following structure: ... struct product { int weight; double price; } ; what's the difference between the 2 fol...
[3 replies] Last: The thing is the syntax of the default initialization you refer on c... (by mbozzi)
Undefined Reference To Class::Function()
 
I don't know what I'm doing wrong. I've checked the includes and my makefile and everything seems fine... I can't find what I'm missing though. It could also ha...
[6 replies] Last: I asked around to some of my other classmates working on this assignme... (by stephcat5)
Make a function return any derived class type
 
I want to make a recursive descent parser, and I want to use different functions for the different kinds of grammar the parser will parse, e.g. a ParseStatement...
[1 reply] : C#: https://stackoverflow.com/questions/9808035/how-do-i-make-the-ret... (by George P)
warning: ignoring packed attribute because of unpacked non-POD field std::array
 
When I try to use __attribute__((packed)), the g++ would give me a warning about POD but the packing is still working (checked by gdb) as I enable the __attribu...
[no replies]
Logic question
 
Question : The rand() function generates values on the basis of a distribution called the normal distribution. One of the favorable properties of the normal di...
[4 replies] Last: If you want floating point random numbers forget using the C library. ... (by George P)
Rewrite recursive algorithm in iterative way
 
#include <stdio.h> #include <stdlib.h> #include <time.h> struct Node { int data; struct Node *prev; struct Node *next; }; struct Lis...
[9 replies] Last: I see tail call which can be replaced with the while loop but there is... (by nowy20180820)
Help needed with Othello game program
 
Hello, I am new to C++ and trying to create an Othello game. My human player function is looping but it does not work for my computer player. I tried to solve ...
[9 replies] Last: In the code you have given (which doesn't compile - try it) you end th... (by lastchance)
C++ Problem Sequence
 
Question: Generate 10 terms of sequence like 1, 2, 4, 8, 16, 22, 26, 38, 62, 74, 102, 104, ... int x = 1,num,num1,n = 1; while( n <= 10){ i...
[2 replies] Last: #include <iostream> using namespace std; int prod( int n ) { return ... (by lastchance)
by lexa19
String vector acces by index
 
I am trying to implement a DFA. I have this method that has a vector of strings as parameteres start(lines.at ); this line of code gives me an error because he...
[4 replies] Last: yes, you are right, now I realise. but how can I give lines as a para... (by lexa19)
Solving rat in maze using DFS
 
Hello, I am trying to represent a maze using two classes: Maze and Cell. A Maze object is a rectangular grid of cells i.e., a 2-dimensional array of Cell obje...
[7 replies] Last: I was asked to have a previous x and a previous y too, in order to pri... (by truckboy98)
Very strange type casting issue
 
Hi, every part of my code is working until I ran into a very strange issue with the code recognition. I put in 10 very low homework grades (scale of 100) For t...
[7 replies] Last: It'll output 70 while displaying "D", right? This is because the varia... (by zapshe)
by vexxt
FStream help
 
Hey all, just wondering how I would go about asking a user via cin, to open a specific output file? Whenever I try, it just opens a file named whatever they typ...
[2 replies] Last: Yeah it is super weird, it's for our class so it's basically to help u... (by vexxt)
by vexxt
Need Help With My Function
 
I'm very new to C++, and this is my first time trying to use functions. For my CS class we have to write a program that reads data in from an input file, does c...
[2 replies] Last: Thanks Andy! I sent you a PM. :) (by vexxt)
"Warning: deprecated conversion from string constant to *char" - help me understand...
 
Hello, on the following code, I get the warning in the title... i.e. "deprecated conversion from string constant to *char". I'm trying to understand the error a...
[8 replies] Last: It (attempted conversion from narrow string literal to char* without... (by JLBorges)
Infinite loop
 
Hi guys, So I'm reading a book on data structures and algorithms and one of the challenge questions was to print out all permutations of a string ABC, so after...
[1 reply] : sorry guys, my bad, in retrospect that actually makes little sense , ... (by adam2016)
Strings in function
 
For part of my project I have to prompt the user to enter their name, number, and email address using a function. I wrote the code for the function but when I t...
[6 replies] Last: As much as I do like the std::tuple method, based on the OP's code sni... (by George P)
Sorting Arrays by even and odd numbers
 
Hello, I am tasked to complete several things in a project. I have some of it figured out but I am struggling with completing it. Here is the full set of instru...
[7 replies] Last: You wouldn't change the conditional, only what it does something like ... (by TightCoderEx)
Calculating time complexity
 
I am supposed to rotate a singly linked list. 0->1->2->3 k = 2 2->3->0->1 I calculated the time complexity of O(n+(n-k)) is this correct? template <class T...
[1 reply] : no. k is a constant. It could be about N, or it could be 1 or 2. do... (by jonnin)
October 2019 Pages: 123456... 18
  Archived months: [sep2019] [nov2019]

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