Beginners - February 2017 (Page 3)

Quick Question about <fstream>
 
Is there a way to make it to where it does not overwrite the file everytime you run the program? I have this so far but it overwrites what I wrote to the docume...
[4 replies] Last: After fixing line 27 (which opens the file in append mode), you forgot... (by Cubbi)
function problem
 
My program will not build and run properly. I have an error saying box is too large for the statement. How would I fix this? #include <iostream> #in...
[2 replies] Last: In addition to the number of arguments not matching you also have the ... (by joe864864)
Getting a second function to work?
 
I'm supposed to write a code where one function calculates the fare of an Uber ride, and the second one outputs the costs and name. I'm encountering two problem...
[1 reply] : One: when I run this code my second function doesn't output anything.... (by cire)
by Sentoo
Temperature Converter with a primed loop
 
Hi there. I am currently working on this assignment and am currently lost. I would appreciate anyone help me get to the right direction. Math equations for t...
[2 replies] Last: Thank you! I really appreciate your work and time spent on trying to h... (by Sentoo)
Palindrome
 
The exercise is: I need to display all of the numbers that are palindromes and are part of the [a,b] interval; a and b are introduced from the keyboard. Down ...
[1 reply] : i is the variable looping from a to b , but you're using n insi... (by dhayden)
function declaration question
 
Is there something wrong with my function declaration? #include <iostream> #include <iomanip> using namespace std; double box(int vol, double sur...
[1 reply] : Remove the semicolon from line 25. (by dhayden)
stuck on function declaration problem
 
I'm having trouble the function declaration. Would I keep void or just use double? /* Program: repair2b: this program prompts for the dimensions of a box (wid...
[1 reply] : Can you put your code inside [ / code] and output inside: [... (by Kourosh23)
Overloading Operators & Polynomials - C++
 
Imagine you are given this polynomial x + 2x^2 and you want to subtract it by 2. How can you do this using the operator minus overloading ? My guess would be: ...
[no replies]
Translate code
 
Hi guys. I'm super new in Programing. Could anyone please help me translate these lines of code? . Thank you so much ! if (getpercentage(95 - object_inf...
[1 reply] : goodness. This is a bit ugly for a newcomer. getpercentage is a fun... (by jonnin)
C++ exercise
 
Hello, I have to do a program like this: We have to introduce a number of numbers. After that, we introduce the numbers. (taken from a file). We sort the prim...
[6 replies] Last: Hello forta2k, I noticed that line 12 only reads the file once to ret... (by Handy Andy)
simple function question
 
I have a question in regards to the function declaration. Would I declare another main to express the function or could I just write out the function? And shoul...
[1 reply] : Its just asking you to add the function prototype where it says //Fun... (by joe864864)
How to convert hexa to base 10 numbers (The hard way)
 
I searched Google and they all convert numbers using remainder. My instructor does not permit to use module operator when converting hexadecimal numbers. Also, ...
[12 replies] Last: No while loops, and no while loops in disguise (ie. no for, no do-whil... (by JLBorges)
error: ā€˜gā€™ does not name a type
 
Hello. I want to create a class and set some values. Unfortunately this code gives me error that is stated in the title. #include <iostream> int main (...
[3 replies] Last: Thank you @jonnin and @joe864864. But it seems too confusing :/. I nee... (by hatecpp)
by Sentoo
Coin Flip using while loop C++ Help
 
Hey guys, I am completely lost after writing a tiny portion of the code. There are the specifics: The user starts with a bank of $10.00 It costs a dolla...
[2 replies] Last: This is what I have changed so far: #include <iostream> #include <ct... (by Sentoo)
by Pampam
Calculator output
 
Hello, (this calculator without operator precedence) the problem is that i want this calculator to output 1+2*3/4=2.25 However, now it output 1+2*3/4= 2.25 ...
[1 reply] : it is doing what you told it. you told it to compute 1+2 (3) * 3 (9)... (by jonnin)
Getting a run time error in my palindrome programme
 
I'm in the process of writing a programme that reads a string to see if it's a palindrome or not. What I have now works however when the string is a palindrom...
[1 reply] : The variable 'pal' is being used without being initialized. If pal i... (by Thomas1965)
getting a ridiculous number
 
for some reason when i enter N as my input for the fifth question i get a number that is far, far too high. Like 20 zeros too high. Does anyone know why? Sorry ...
[2 replies] Last: Thankyou! (by Baconator)
parameter of a function to another class
 
hello programmers, I'm trying to write two classes and make aggregation of the two classes: one to get one'd birthday and the other check if the bday is in cer...
[1 reply] : now I'm building another class that check if the bday is in certain r... (by gunnerfunner)
Trying to output in a certain way
 
Okay, so I am trying to have a specific output that I want to get, but it prints its out a bit differently. And I wasn't too sure how to print it implement the ...
[5 replies] Last: still unable what to do here. how do i print out the prerequisites. ca... (by kikiyox77)
Anagram function not returning
 
Hi, i'm a beginner in c++, and i can really use some help here. In the code, when i run it, the program does not process the strings i am entering. Am i missing...
[3 replies] Last: thanks so much! (by rapmonnn)
February 2017 Pages: 12345... 37
  Archived months: [jan2017] [mar2017]

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