Beginners - March 2019 (Page 2)

include
Hello, I have four files: AllOnesGA.cpp, GeneticAlgorithm.h, Individual.h, Population.h My idea is to include the .h files in the .cpp file but it doen't work...
Mar 30, 2019 at 11:27am
[2 replies] Last: It depends entirely on what the dependencies are. Any file (be it .cp... (by salem c)
Directions
In the code given below, Line # 91 stores a value to the east of i=0 and j=0. using [k + 1] as index terms. Line # 92 stores a value to the west of i=0 and ...
Mar 30, 2019 at 9:47am
[3 replies] Last: 1. Add some convenience variables. 2. Rename some of the cryptic 1 and... (by salem c)
timer function - how to improve?
I don't feel so comfortable using the following code I wrote. How can I make it better? #include <time.h> void timer(int interval){ clock_t timeIn...
Mar 30, 2019 at 9:27am
[3 replies] Last: Your program loops as long as 'interval' endures through your while lo... (by nuderobmonkey)
Plz help
so here's my problem. despite making the class "PointerC" public, I cant use it anywhere else. basicly all this program does is print pointer values to the scre...
Mar 30, 2019 at 5:56am
[7 replies] Last: > If Int is calling a variable, then PointerC is like int. We say 'int... (by salem c)
Create 3 functions that print initials using asterisk.
I'm writing a program that is supposed to print out the 3 letters of my initials using asterisks. My problem is I keep getting the error message, "a function-d...
Mar 29, 2019 at 10:40pm
[4 replies] Last: Thanks again AbstractionAnon. I was a little tired and out of it earl... (by BIGB185)
Attempting to create a 2D dynamic array for unknown values
I have a file that I need to read. The file should be read such that once the code reads a number all the following strings goes in to that row of the array. Fo...
Mar 29, 2019 at 7:44pm
[6 replies] Last: Thanks all...tried all. lastchance's and dutch's worked as listed. The... (by sunshine4)
Program returning "inf" instead of calculated value
I am new to C++ and in order to practice, I tried writing a program on an online compiler to calculate the Maximum Stress in cantilever beams when placed under ...
Mar 29, 2019 at 5:46pm
[4 replies] Last: Thank you so much everyone for the advice! My code is now working corr... (by haro227)
Smart way of finding a number with changing the range
Hello, could you help me in adding additional logic when the find number function randomly pick a number less than the guess number or greater than the guess...
Mar 29, 2019 at 4:46pm
[1 reply] : the smart way is to not pick randomly, but to cut it in half every tim... (by jonnin)
by Alb13G
exponent function Without POW or Multiplication (1,2)
this seems challenging Write a function that accepts two input parameters and computes the result of raising the value of the first input to the value of the s...
Mar 29, 2019 at 3:50pm
[21 replies] Last: I was saying you can use the * function you wrote, using adds... as f... (by jonnin)
by ICantC
Parse question
I'm trying to parse a text file which will have many lines similar to this: 2019-03-25 08:43:12,628 [23 ] DEBUG [Msg:533] - 83051731101211 and I want to ou...
Mar 29, 2019 at 1:21pm
[8 replies] Last: edit: it also stops reading the line once a character is hit rather th... (by jonnin)
Beginners Hangman quick
Use IF, loops, switch, and string statements to create a basic hangman program. You will have to: 1. Create a string variable for the secret word 2. Create a st...
Mar 29, 2019 at 12:44pm
[4 replies] Last: // basic hangman program #include <iostream> #include <string> using ... (by MikeStgt)
Pass by value
Hello, I had a question regarding passing parameters by value into a function, and what exactly happens. int* test(int b) { b++; return &b; ...
Mar 29, 2019 at 10:05am
[3 replies] Last: Yes. b goes out of scope when the test function ends. (by Peter87)
Help with editing/correcting code
Hi all, I've completed a basic assignment for a class of mine. This is a assignment where you need to use classes to basically show a price of comuputer, mon...
Mar 29, 2019 at 10:05am
[1 reply] : > *this = Complect (name, computername, monitorname, price); All these... (by salem c)
by Bopaki
Program compiles OK but bombs out when running it
The skeleton of the program in from the bo0k by DS Malik. Three functions were not defined there and I defined there and I defined them myself viz: int searc...
Mar 29, 2019 at 9:50am
[2 replies] Last: Thank you very much lastchance!!!! It worked very well after changing ... (by Bopaki)
Why am I getting garbage values
The program out puts almost correctly, but does not give me the grade,instead gives me garbage values. #include <iostream> #include <string> #include <fst...
Mar 29, 2019 at 9:45am
[9 replies] Last: Thank you ! (by ames1951)
by daveed
Anyone know why my find method is returning false all the time?
When I try to get true by inputting the correct isbn, it still returns false. Any Ideas? bool Warehouse:: find (string isbn, Book& book) const{ boo...
Mar 29, 2019 at 8:14am
[1 reply] : Use a debugger, or add some debug printing of your own. for (int... (by salem c)
by daveed
Why is my list method only printing the last book
I am building a list method to print out all the books in the warehouse. Which in theory should print all the books read from the file book.dat. However, when r...
Mar 29, 2019 at 6:36am
[1 reply] : > istream& operator >> (istream& is, Book& book){ This reads the WHOLE... (by salem c)
by gifm
Loop with Nested If Problem
Hello, I am trying to do a program that involves loops and a nested if. The user needs to input a hotel specification, and if it meets the criteria to ask furth...
Mar 29, 2019 at 12:26am
[2 replies] Last: Thank you. (by gifm)
Overloading Functions
I'm learning about overloading functions. The program must multiply an integer, double and a combination of integer and double. What I'm having trouble with ...
Mar 28, 2019 at 9:26pm
[2 replies] Last: I think it's asking to display the product of the integer and double m... (by simulationspecimen)
PR Numbers
Problem link : https://www.hackerearth.com/challenges/competitive/march-circuits-19/algorithm/pr-numbers-160aa0c9/ Can anyone help to explain problem statement....
Mar 28, 2019 at 8:36pm
[6 replies] Last: so, my given numbers are right in between 1 and 100 ? (by cool123dude)
March 2019 Pages: 1234... 25
  Archived months: [feb2019] [apr2019]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.