Beginners - June 2020 (Page 9)

Averaging Code Not Running
 
There are no errors that I can see or noted in this program but for some reason the for loop doesn't run. #include <iostream> #include <iomanip> int m...
[5 replies] Last: @Ganado, Strange it compiled for me when I wrote it, more to the poin... (by Handy Andy)
main.cpp:47:55: error: lvalue required as left operand of assignment
 
Write your question here. Need to compare the sales value of two sales teams in a company. Then need to assign a score by comparing those to figures monthly....
[5 replies] Last: Hello hekanayake, Based on above i assign values to two arrays .... (by Handy Andy)
Am I unit testing correctly?
 
Hi I am currently writing some unit tests for a library which I've written. As an example, say I'm testing a particular a method called doSomething() then my t...
[3 replies] Last: Find the happy medium that gets you to where the error is found. O... (by jonnin)
Reading Specific Record from a Data File
 
hi everyone, I am trying to read a specific record from a file. The "nutri.dat" was written by using a class that iterated to write the user input. Now ...
[3 replies] Last: Also read this -> https://www.cplusplus.com/articles/jEywvCM9/ You att... (by salem c)
Trouble with a random number generator
 
Hello there, I've been working on a program in which a certain item from an 84 characters long array, (let's call it v ), gets picked in a random way using a fu...
[2 replies] Last: Thanks, now the program is working, the issue laid in srand() not bein... (by Theloneinteger)
Two Dimensional Vectors
 
I just learned about two a dimensional vector, and filled it with the 12 times table as an exercise to practice with. I got it to work. However, I am curious if...
[7 replies] Last: I appreciate everyone's examples. Definitely much more efficient. kes... (by stoneJax)
Lottery Code - C++ - Matrix and Vectors
 
Hello people! I am making a code in C ++ that simulates a lottery, the user enters 6 whole numbers, the code shows the numbers in a 6x10 matrix, performs the...
[1 reply] : #include <iostream> #include <iomanip> #include <set> #include <algo... (by dutch)
Replacing a word in a text using loop
 
Hello, How do you replace every "dicktionary" word in a text with "dictionary" using loop? Original text: I love my dicktionary . A dicktionary helps me to...
[7 replies] Last: One does not need to search the already processed text repeatedly: ... (by keskiverto)
simple max prime problem
 
Hello there. i have this part of a program that i'm wrting. it's working but it's not giving correct answers. i need to find max prime number of all entered num...
[11 replies] Last: Given that in your code flag is only 0 or 1, this else if (flag == ... (by Repeater)
by rock33
can't print the variable in vector
 
Hello, I am in the first data structure (hash table) I insert the data, each filled cell is connected to a disjoint set precisely in the other class. the prob...
[6 replies] Last: this is open adressing hash table, double hash and disjoint set is a r... (by rock33)
Two Players Card Game
 
Two players are playing a card game. Each card consists of a rank (from 1 to 13) and a suit (S, H, C, or D). For any two cards, the card with a higher rank is c...
[3 replies] Last: #include <iostream> enum suit { diamond, club, heart, spade }; enum ... (by againtry)
Imprecise Averages
 
I'm trying to get the code here to be more precise, down to at least the second decimal but I don't know-how. #include <iostream> #include <iomanip> i...
[2 replies] Last: You're entering doubles but storing sum as an int. Change line 8 to ... (by dhayden)
poor pointer hygiene example
 
"USING UNITIALIZED MEMORY 'isSunny" how do I fix this line 23 to make this example run? this is an example from the book. thank you // Listing8.1...
[7 replies] Last: You could also move all the pointer work inside the if statement: Bu... (by dhayden)
Reversing lines & outputting to text file w/o vectors or arrays
 
Really stumped here. Basically taking a multiple line text file such as this: Mary had a little lamb Its fleece was white as snow And everywhere that Mar...
[14 replies] Last: I understand that you can't use vectors or arrays. Are you required to... (by dhayden)
max prime in a 2D array bug
 
i have this part of a program code, which purpose is to find max prime num in a 2D array. it should work fine.. but for some reason it only checks the first ro...
[3 replies] Last: @Ultralegendary thank you , it worked. i get it now :) (by jeraya6)
Console read out issue
 
The program is not displaying my cout statements un the second half of my program. What doesn't it work and how can I fix it? This issue starts at line 59. ...
[3 replies] Last: just check whether the crusor is moving after your input or not, text... (by Ultralegendary)
by bld
A quick-start guide for C++?
 
Hello, I'm very new to C++ and I was wondering if there's some sort of a quick-start guide for total dummies. I'm not looking for something super long, even th...
[3 replies] Last: c++ take a while to learn. There are some short guides but the langua... (by bld)
by ebicw
how would I make a better fight? such as making a certain amount subtract from enemyHealth
 
Write your question here. int main() { int enemyHealth = 10; int attack = 1; cout << "hit one to attack the enemy!\n"; while (enemyHeal...
[1 reply] : If you were playing with traditional dice... If you allow the occasio... (by salem c)
Assigning string values to a 2D array, error
 
Can someone explain what is wrong with this assignment of string values to a 2D array? I don't get it. #include <iostream> #include <set> #include <st...
[2 replies] Last: Thanks! (by mrpear2020)
by Utku
Get instance of class from another class
 
Hello. I have a question about getting the constructed object that is created in main() function from another class. class A { int a; public...
[6 replies] Last: Thank you dhayden. I tried the function and it works. There is no need... (by Utku)
June 2020 Pages: 1... 789101112
  Archived months: [may2020] [jul2020]

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