Beginners - May 2020 (Page 16)

by Contim
Logical error
 
My question is whether anyone can tell me what the flaw is in my while () control structure loop that is causing the number of dishes to be incorrect. It tak...
[1 reply] : This: timeToCompleteThisDish = timeTakenSoFar + b; should be: ... (by dutch)
by jc3992
type int unexpected
 
Hello everyone, Just edited it as solved after I added: using namespace std; using std::vector; using std::string; changed to int i2=0, int3=0, int5=0; a...
[2 replies] Last: Initially I used int i2=0, i3=0, i5=0; but generated the same error. ... (by jc3992)
Do-While loop question
 
#include <iostream> int month; int main() { //month input do { std::cout << "Please enter the month of your birthday as an integer"; std::cin >> mont...
[3 replies] Last: Hello noblemin, You are welcome. Whether it is an if statement or a ... (by Handy Andy)
Hotel Room Calculator. Output is incorrect?
 
I made this program to calculate hotel expenses. Everything works fine, except the output is rounded off as an integer, when it should be a double. For example,...
[2 replies] Last: Ahh, of course. *face palm* Thanks man :) (by GamerAid)
Inheritance problem with code
 
I used to use Enemy class to make objects, but now i haven't made it abstract yet but i want to. My problem is how to return new instances of objects based on t...
[10 replies] Last: Thanks mbozzi, that's exactly what i was looking for. (by FJ39j39fs)
Need helping writing a code
 
Write your question here. Write a program that creates an integer variable and then assigns a random number to it. Ouput the variable and verify it falls bet...
[4 replies] Last: The problem is that the normal text (problem statement) is now harder ... (by andywestken)
Generating different random numbers
 
Q= How do I generate random numbers that are different from each other in the following code? srand(time(NULL)); a = rand()%maximumValue+1; srand(time(NU...
[10 replies] Last: I find this gsl::narrow, very useful. I actually found some bugs with ... (by thmm)
how fix missing template arguments before 'test'
 
i need use 3 class , + operator, vector and template but i get error #include <iostream> #include <string.h> #include<vector> #include <iostream> #inclu...
[1 reply] : Line 112: out_u test; You need to provide template arguments for th... (by malibor)
by mnnsa
pattern printing
 
how to print this type of pattern in this example n is given 5 and the pattern forms with 1's and 0's outermost is made of all 1's next inner is made of a...
[1 reply] : #include <iostream> #include <vector> #include <string> using namespa... (by lastchance)
by sparki
Class template cannot be constructed
 
Why do I get a compilation message error ''SeeAndSay::AnimalWrapper': class template cannot be constructed'? Thanks in advance! #include <iostream> #include...
[1 reply] : m_animals.push_back(new AnimalWrapper <T> (animal)); ... (by Repeater)
I need help with a program using selection sort
 
So, I figured I had my code working. However, when ran its not displaying the pitchers names from my file. it displays the ERA in ascending order, just not the ...
[1 reply] : The gibberish probably comes from myFile.get(pitchers ,30); What val... (by thmm)
by roiboi
How to cout first value of dynamic variable ?
 
I coded some classes and overloaded << operator. When i cout a dynamic variable of my classes, it shows me its address. I am looking for an alternative that i...
[2 replies] Last: Treating a pointer to a single instance as an array is a bad idea. The... (by jlb)
How can I pass vector a an argument; getting an error
 
Hello, I built a vector of string elements. Then I am trying to pass such vector as an argument on another function. However I get an error main.cpp:47:32...
[2 replies] Last: Oops, sorry. Thank you very much! (by mrpear2020)
Access-violation reading location
 
So I have been trying to eradicate this error for a few hours now but I was unable to. I am making a 2D game where I am reading different maps for different scr...
[5 replies] Last: Please post the declaration of class Map. Ideally, please post a prog... (by dhayden)
by nixUe
string to cstring trouble
 
I am struggling with a project in which you read lines from a text file, put the said strings into cstrings, and reverse them. I am not allowed to use the actua...
[1 reply] : If you must use C-strings, then use C-strings for everything. You're p... (by jlb)
Does anyone can help me with java?
 
I have to make a java program to find the shortest path between to points to avoid the landmine field. The path must not pass inside of the landmine field but t...
[2 replies] Last: Yeah, I saw it that's why I have that name on my topic. Anyway, thanks... (by joe2011)
Basic Pointer/Address Question
 
Hello all, I just have a quick question about pointers/adresses. If I am being asked to print the value of a variable and the address of that variable ,is the a...
[7 replies] Last: Andywestken has already explained how you were wrong and corrected you... (by MikeyBoy)
Trouble Setting up a Function and Some Fluff
 
Good day, fellow Quanrantinos! You may remember me from my current project of making a fast character generator for D&D in Visual Studio 19! Thus far, I've ma...
[9 replies] Last: Alright, then would that replace my else lines below the first if It... (by MikeyBoy)
Why do I have errors about variables that I pass to a function to compute the multiplication of 2 matrices?
 
Hello, I am trying to calculate the multiplication of 2 matrices. I have firstly dynamically created the matrices following user input of their sizes. Then ...
[4 replies] Last: Hi, Following your feedback, I went back to the old code and did thi... (by Shishykish)
Windows Dumping Stack Trace
 
I dont know how, but this simple code produce a stack trace error.. exactly when i add the arrowed line.. Do you guys know why? #include <errno.h> #include ...
[3 replies] Last: it works fine on my cygwin with -Wall -Wextra -std=c++17 -pedantic-er... (by jonnin)
May 2020 Pages: 1... 14151617
  Archived months: [apr2020] [jun2020]

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