Beginners - October 2019 (Page 14)

using default for something else but still need an error message - switch statement
 
I have a problem where I'm trying to write a program to calculate the compensation for days without luggage on Air Canada. I need to have an error message if th...
[2 replies] Last: Hello maigistr, PLEASE ALWAYS USE CODE TAGS (the <> formatting butto... (by Handy Andy)
loop question
 
hi I am trying to loop this code for a user defined period can anyone suggest how i would do this? i am thinking some sort of look but i'm not sure how to imple...
[4 replies] Last: Hello farmerjohn, That is easy. After the line count++; add a line ... (by Handy Andy)
Weird value from finding a variables address
 
I've been doing a very basic C++ course online, and one of my first tasks is to create code that sets several variables (called a, b, c, d, e.) a value for thei...
[3 replies] Last: Thanks guys, I tried 'void' and it worked. Still learning the vocabula... (by Hatched Nails 567)
Need guidance on how to calculate average of all inputs with loops
 
//Finding smallest number in a series of user input of numbers #include <iostream> using namespace std; int main() { int age, smallest = 1000, grea...
[3 replies] Last: #include <iostream> int main() { int count { }; double sum {... (by George P)
by Tru
The same member function for 100 classes
 
Hello all. Is it possible to declare and define a function once: int MyFunc (int a, int b) { int c; c=a+b; return c; } And use it in c...
[11 replies] Last: @Furry Guy: I got it now. Thanks. I added the .h content. (by Tru)
Make a random generated map within 5 and 50
 
My goal is to give the user an option of choosing the map size, or choosing random map size. If chose random, I need to keep the map size between 5 and 50. I al...
[3 replies] Last: #include <iostream> #include <string> #include <cctype> // tolower #... (by George P)
by tinaHR
String substring & indexOf
 
Hi all, i am stuck with part of the code and cant figure out where is the problem. Exercise is to play a game where you guess a movie title letter by letter unt...
[3 replies] Last: I threw it in the garbage can after trying to translate a very simple ... (by jonnin)
Sorting Data From Text File
 
I need help on how to write a code that reads and sorts the data from a text file in ascending order. If anyone can provide an example, I would appreciate it! ...
[1 reply] : Hello Orion98, Do you mean to read the input file and sort as you rea... (by Handy Andy)
divisibility check
 
*** Codechef alert *** And the OP has disappeared!
[1 reply] : Create a struct or class to track the factors and the number of times ... (by dhayden)
I am new in C++. please correct me!.
 
Write your question here. Question: Does the behavior of the following two codes are correct? DataSource.cpp: #include "DataSource.h" #include "Mem...
[2 replies] Last: Is it correct? That depends on what it's supposed to do. Since we don... (by dhayden)
to find average for each integer
 
I have two columns in a txt file. Both columns have integer values. column1 contains ID and column2 contains ratings. I want to find average ratings for each ...
[3 replies] Last: struct stats{ double sum = 0; int n = 0; double average() co... (by ne555)
Setter function not working?
 
Hello I'm trying to get a setter function to store an integer, but the data entered stored end up weird when I try to access them (610861952 & 32764). I'm not v...
[2 replies] Last: Your dummy main() is using startRow uninitialised, but who knows what ... (by lastchance)
Possibly really stupid question about data structures
 
Hello, I am learning about data structures, and the videos i see creates the data structure, for instance a linked list, and then just fills the linked list by ...
[1 reply] : you may read from a file while (input >> a >> b >> c){ l.append( i... (by ne555)
User identified input from computer
 
Hello, I am currently working on to create text to Binary converter. There is no problem in the code. However I want to type the text(to convert it into binary)...
[3 replies] Last: Thank you! (by NoobProgrammer002)
Undefined reference to template class
 
What am I doing wrong here finaladt.h #ifndef FINALADT_H #define FINALADT_H #include <iostream> using namespace std; template<class Type> class finalADT { pu...
[3 replies] Last: Delete the definition of those functions I know what you're trying to... (by mbozzi)
Adding and subtracting money question
 
I've been introduced with friend functions and the like and have been trying to fix my code. I can't see what is wrong with it though. Any help will be apprecia...
[2 replies] Last: Oh! Ok that did the trick. Thank you! (by Deadweight77)
Cant figure out error in Bank Simulation logic!
 
My problem is that when I run the simulation for the bank it keeps removing the wrong customers from the Queues at incorrect departure times. Also when it reach...
[3 replies] Last: Cross-posted to: https://stackoverflow.com/questions/58263542/cant-fi... (by George P)
Calculating GPA from User Input (with constraints)
 
Hello, I am having some trouble creating a simple program to calculate a GPA from user input due to some constraints placed on the assignment. Namely: ...
[3 replies] Last: I think I solved it using 'cin.get', but if anyone has any other solut... (by confundido)
Reading from file and placing its contents into an array of objects
 
Hello, I've been trying to read from a file and place its contents to a array of objects in a class and trying to sort them with QuickSort, MergeSort, etc. as a...
[2 replies] Last: Not much, since my teacher at the time didn't do a good job explaining... (by GachaLuck)
without using arrays or vectors
 
Brian is a shopaholic. Whenever there is a discount of the kind where you can buy three items and only pay for two, he feels the need to buy all items in the sh...
[5 replies] Last: Where are you initializing the total and discount? Also, if conditi... (by Duthomhas)
October 2019 Pages: 1... 1213141516... 18
  Archived months: [sep2019] [nov2019]

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