Beginners - June 2019

Random numbers on different systems
 
Hi guys, I have a question: If I use std::seed_seq seq{1,20,3200,403,5*randomseed+1,12000,73667,9474+randomseed,19151-randomseed}; std::vector<std::uints32...
[5 replies] Last: Thank you guys! (by PhysicsIsFun)
if else ladder troubles
 
So for my C++ class, we were assigned to make a program to assess the cost of wooden desks. Although it's advised to not ask for homework answers, I can't seem ...
[6 replies] Last: Got it to work finally, thank you! (by saturnz)
ifstream dont accept a string as input.
 
(Im sorry if u saw any english erros becouse english is not my main language) Hey Guys, I recently made a function to read a file, but she has a problem that i...
[9 replies] Last: It worked thank you :D (by troyaan)
Need Help in this question
 
Mark has 'N' days. Initially he is at position (h1,0) on the X-axis. On each day he can go to the co-ordinates (h1+a,0) or (h1+b,0) or (h1+c,0) . He can select ...
[5 replies] Last: Isn't the purpose of competitive challenges to show the extent of your... (by keskiverto)
Help on a string program
 
Our teacher is very specific. He gave us a program that wants you to read in a data file with names and sort each one in a lastName,FirstName Middle method. We ...
[12 replies] Last: If you are absolutely certain of the number of names and the possible ... (by lastchance)
C++ while loop with a conditional statement. Read an input and skip every three times before taking action.
 
New to this, your help please anyone. Thanks. Extract below read's pressure value A. If it's 200000, B is actioned. However, pressure follows a sign wave flu...
[1 reply] : > Extract below read's pressure value A. If it's 200000, B is actioned... (by salem c)
Problem with Setw function...
 
Please note the only print_strip(int picked_team, int wickets) function in the program. The problem I am getting is in the setw() command I am using and it is...
[4 replies] Last: Ok, I got it :) I went with to_string option and it worked perfectly ... (by sindhu05)
assignment
 
encrypting and decrypting using the alphabet; Assignment Specifications Decryption and encryption is a very useful activity to hide messages or data. Encryp...
[3 replies] Last: so apparently my map has to start with a = 0 and b = 1. the char lette... (by marcopololara)
MS Vis Studio "not a type"..??? error (1,2)
 
I am new to using MS VS 2015 - which I acquired for getting into my C++ studies and training at the moment. Long story short==> I made a simple class in a head...
[35 replies] Last: Been there, done that, bought the T-shirt. (by Niccolo)
by kmce
while loop. While cin >> !=
 
Hi, I am doing a drill from the book I am learning from, and i need to run a while loop until '|' is entered. I have been trying such things as while cin >> != ...
[4 replies] Last: If that's Stroustrup's book, at some point he explains that any string... (by Niccolo)
Question about return statements in a void function
 
Hi all, I'm trying to wrap my head around void functions, and the only part that I'm unsure about is the return statement. The book I'm reading gives the foll...
[3 replies] Last: There can be a use for explicit return in void function: void echoSqu... (by keskiverto)
Classes
 
Hello, 1. Why is there '&' symbol in this parameter?? CVector operator+ (const CVector& first, const CVector& second) or this one also bool Dummy :: isitme(...
[2 replies] Last: [quote=jonnin]is the current object equal to the one passed in Carefu... (by keskiverto)
What Is Wrong ?
 
Just starting out in C++. Why is my code so slow ? The nested loops below I think would take a day to complete while the same code in Java completes in a few se...
[8 replies] Last: Unlike Java, C++ has the concept of undefined behaviour. The original ... (by JLBorges)
by mcclit
how to ignore the negative number that is used as a break for the for loop
 
how to ignore the negative number that is used as a break for the for loop? #include <iostream> #include <string> using namespace std; int main() { ...
[3 replies] Last: Unless I'm missing some very obvious, variable total gets initialized ... (by mycuser)
by rad48
payment table (for loop)
 
Hi everyone I am new to C++ and have problem creating a table of payment ,for 10days max and first day payment 5 doubles every day 5,10,20,40 so on have to use ...
[6 replies] Last: pay = 5; cout << '0' << "\t\t" << pay << endl; for (int num = 1; num ... (by keskiverto)
another nested for loop snag
 
Hey guys. I put together some code that finds a word in a string (string x called strx) and returns a substring around that word (string y called range1). I am ...
[10 replies] Last: You're a 100% right. I extracted the code for testing and it caused ha... (by codeprog24)
by kmce
for loop
 
Hi, I am going through a c++ book and came across a new way to write a for loop, it was taught using a vector but I wanted to see if i could use it for other th...
[2 replies] Last: ....... of course lol. Such a stupid mistake. Thanks for answering :) (by kmce)
C++17 <filesystem> Doesn't output what I expect?
 
I'm following this tutorial: https://www.bfilipek.com/2017/08/cpp17-details-filesystem.html I'm using Visual Studio 2019 and C++17. The tutorial's code uses...
[7 replies] Last: [quote=JLBorges]> Why did you use std::wcout instead of std::cout? On... (by PiggiesGoSqueal)
Infinite While Loop Issue
 
Well, I took a few days break from programming and I somehow managed to forget like 40% of basic C++ info.. And am struggling to do basic things. In short, I w...
[2 replies] Last: [quote=Ganado]What is your input? If you're trying to type in multiple... (by PiggiesGoSqueal)
Member initialization in constructors
 
I take this program from the article : #include <iostream> using namespace std; class Circle { double radius; public: Circle(double r) : ...
[5 replies] Last: What do you mean by "doesn't work"? What doesn't work? Does it not... (by MikeyBoy)
June 2019 Pages: 123... 13
  Archived months: [may2019] [jul2019]

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