Beginners - March 2022 (Page 2)

by Pen72
Group of friends
 
There is a group of n people indexed by positive integers from 1 to n forming a network of friendship. Friendship of x and y is denoted by a pair(x,y), which...
[2 replies] Last: How about vis = true; and vis = false; (by Pen72)
Need Help with Assignment. Now sure how to start
 
This assignment requires you to maintain ratings for products sold by a company. Each product sold is stored in an array. A rating for a product consists of ...
[3 replies] Last: You're given a lot of the data and function declarations already. Cop... (by dhayden)
When is memory allocated for a vector?
 
Greetings, I have a short question. If I simply declare a std::vector of N doubles, i.e. std::vector <double> (N); , when will the memory of N d...
[5 replies] Last: It's interesting to consider what happens when you add a bunch of valu... (by dhayden)
issues with dat file
 
solved
[14 replies] Last: Someone burned a bridge too far for us to reply. (by George P)
Why does it break out of the loop?
 
Why does it break out of the for loop if I write a number that isn't equal to either 1, 2 or 3 (for example 4)? I understand why it breaks out of the loop when ...
[4 replies] Last: Thank you very much everyone! I will definitely read more about the co... (by gust3lis)
keeps sending out a random number
 
please help also i cant use global varables //Nico Kalin OConnell #include <iostream> #include <iomanip> using namespace std; int validate(int); int main() {...
[6 replies] Last: There are three ways to pass a variable into a function, two inherited... (by George P)
When I enter a char the program goes infinitiley
 
I tried putting the cin.fail() incase so that I can stop the loop and let the user enter a value again but then its infinite loop void strassenMultiplicati...
[6 replies] Last: @freshman236784, I hope you know that in genuine (and worthwhile) Stra... (by lastchance)
Template
 
There was no detected errors on the code but there was still undefined reference problems: MAIN.cpp:(.text+0x64): undefined reference to `listsavitch::operat...
[5 replies] Last: #include <iostream> namespace listsavitch { template<class Item... (by seeplus)
Unique pointer assignment operator
 
Just started learning about smart pointers and my professor uses the assignmet operator like this in the slides. unique_ptr<double> p{}; p = new double...
[3 replies] Last: See https://stackoverflow.com/questions/22571202/differences-between-s... (by seeplus)
Native webrequests with WS2_32
 
I've been trying to create a back-end for a RSS Client I'm working on. I took a snippet of code for the basic architecture of the code (besides the code is also...
[8 replies] Last: I can imagine. I once built a parser that recognized spaces between in... (by alfanjui)
Counting unicode characters in an array? (1,2)
 
How can I count all characters in an array with Unicode characters? strlen() gives more and isprint() gives less value. I can't find the right one. In the code,...
[23 replies] Last: Thanks for your help. I learned a lot. (by bydrachen)
Deque-Implementation push-front
 
Hello fellow programmers, here I am again with another question. I'm currently trying to implement a class structure for a Deque with the two functions pus...
[7 replies] Last: Thanks a lot @jonnin and @coder777 that helped a lot and i figured it ... (by Mae4ashy)
Error with global string in multiple functions...
 
I declare a global string and give it a value "ABC" in Function1. When I try to cout it in my main function, it gives error: Terminate called after throwing an...
[2 replies] Last: Code looks something like this... Well, if it looks like that then i... (by lastchance)
vector: entering weights
 
Write your question here. Program goal: User enters five numbers. Store the numbers in a vector of doubles. Output the vector's numbers on one line, each ...
[2 replies] Last: OP. L8 defines a vector that has 5 elements. L19 - pushes a new value... (by seeplus)
Bulgarian Solitaire
 
Been trying to do a Bulgarian solitaire c++ program with a default n value of 45 and it's been a complete catastrophy (I'm new and learning about arrays so keep...
[4 replies] Last: Use std::sort(). See L77 above in lastchance's code. (by seeplus)
Triangular Random Number Array
 
Hi, this is for a project I was working on and I've ran into some specific issues with random number and I kind of need help with it Background: It is supposed...
[11 replies] Last: Just plodding my way through step by step it ends up as the following ... (by againtry)
Passing array to function
 
Question 1: I was able to use a range-based for loop (RBFL) in main() for my array, but when I passed it by value (which makes a copy) to a function in PassArr...
[13 replies] Last: https://stackoverflow.com/questions/5724171/passing-an-array-by-refere... (by againtry)
Converting 400 line VBA function to C++ (1,2)
 
I am trying to convert a 400 line VBA function to C++. I can't work out how to replicate this system in C++. I tried to convert each "gosub xxx" into a "void xx...
[23 replies] Last: I have decided to post a different module which exhibits the same desi... (by naturtle)
C++ Rational Class with Constructors
 
How am I supposed to implement a second constructor that converts "void" to rational (where input == 1)? I am a beginner programmer working on an assignment for...
[8 replies] Last: As a C++ solution using operator overloading, consider: #include <i... (by seeplus)
adjust list by normalizing
 
For this program I need to alter the values in a vector by dividing all of them by the max value. The input will start with the number of elements in the vector...
[3 replies] Last: #include <iostream> #include <iomanip> #include <vector> int main()... (by seeplus)
March 2022 Pages: 1234... 7
  Archived months: [feb2022] [apr2022]

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