Beginners - February 2017 (Page 2)

Rotating a point in 2D shows inaccurate result
 
I'm trying to create a member function called 'rotated' in class 'Point'. However when I try to rotate (1,0) by 180 degrees , I get the output as 0.00555556,-4....
[4 replies] Last: Changing it to (angle*M_PI/180) worked and gave (-1, 1.22465e-16). Tha... (by DeKonTiki)
Read data from file to 2D array
 
Hello everyone, I am having trouble with an assignment where I have to read in letter grades from a file and then display them on screen. My thought process was...
[5 replies] Last: Thank you both for your help :) (by likeToRead)
if / else if / if else
 
So today someone told me there is no function called else if, is that true? I know if exists Else exists But else if does it exist?
[5 replies] Last: depends on how technical you are. if () { } else { if() //not... (by jonnin)
Simple beginner program!
 
I'm doing this program on Mindtap and the website keeps giving me a score 50%. The question is: "Paula and Danny want to plant evergreen trees along the back ...
[3 replies] Last: Paula and Danny want to plant evergreen trees along the back side o... (by MikeyBoy)
user defined functions, what am I missing?
 
Hello. I began learning C++ several month ago and am currently enrolled in a class for beginners at my university. I code almost every day and have the basic ...
[5 replies] Last: All good. Not using std comes a bit later. For your program you would ... (by closed account 48T7M4Gy)
composition why is this not legal?
 
Hi I'm just wondering why I get an error with this code the error is line 8 :no matching function for call to birthday::birthday()' birthday.h #ifn...
[4 replies] Last: thanks guys (by adam2016)
multiplication & division not working
 
So I wrote this code and I found that the multiplication and division are not working. The only thing that works are the addition and subtraction. #include ...
[4 replies] Last: @OP You can replace the cascade of if statements with a switch contro... (by closed account 48T7M4Gy)
Colors are not working
 
Why does it print only black when I run it? #include <curses.h> char *map = { " #### ", ...
[2 replies] Last: #include <curses.h> char *map = { " ... (by Mantorr22)
Converting english to morse code (1,2)
 
Hello I have three questions: the first one is when I run my code and enter text for it when it returns its one letter short and as a result it doesn't give the...
[29 replies] Last: why do we need to use arrays knowing that they are problematic at lea... (by dhayden)
by AlanG
unexpected printout for int
 
Here is my bash session: agauld@ubuntu:~/src/cc/tour$ cat testinc.cc #include <iostream> #include <stdio.h> using namespace std; int main(){ int n = 0; ...
[5 replies] Last: From the horse's mouth: undefined behavior behavior for which this ... (by JLBorges)
Why is my switch infinite?
 
Write your question here. #include <iostream> #include <iomanip> using namespace std; int main() { // Declared Variables const double P...
[2 replies] Last: @whitenite1 Omg, so silly. Thank you it works now! (by kattykat243)
error in my code
 
i have done the code. But when running it, it cannot do more than 3 instruction. Please help. Thnx in advance. #include <stdio.h> int main() { in...
[3 replies] Last: i think i found the problem. i put .2f in the scanf("%.2f",hourrate). ... (by teopeishen)
Question on If / Else if statements
 
The basic idea for the code below is to generate certain responses based on many different constraints and differing user inputs. The code is only allowed to ...
[5 replies] Last: Thanks for all the info guys. Much appreciated! (by rshrecky)
error message
 
I get an error saying lost in scope dist0 and dist1. I'm lost on where to fix this code. My guess is the functional declaration. Any thoughts? #incl...
[2 replies] Last: Since the intent is to set values to the arguments passed by reference... (by JLBorges)
Body Mass Index Program with void function
 
I'm studying functions, functions prototypes, declarations. First I tried to create a function with a string return. Then I figured out it is complicated. Here ...
[6 replies] Last: #include <string> #include <iostream> void BMI(); int main () { ... (by closed account 48T7M4Gy)
by WestAU
Time between allow else error...
 
Sorry to ask what i thought would be an easy to find answer LOL. I am trying to do the following... if current time is between 07:00-09:00 allow the follo...
[3 replies] Last: Thanks i will give this ago, basically i want to simply allow connecti... (by WestAU)
by xx123
headers, classes & main
 
I am new to headers and the main cpp file. So i have to create a program that calculates an employee's salary using her sales and I have to average every single...
[9 replies] Last: I made some changes: class Employee { public: Employee() {} Em... (by TheIdeasMan)
simple question
 
I get an error above time, dist0 and dist1 saying expected a deceleration. I don't know why it does this, is it because I'm using const double? /* Progr...
[1 reply] : remove the semi-colon from end of line 39, compile your code and go th... (by gunnerfunner)
Eliminating 0
 
I've got a string of n numbers,introduced from the keyboard.For every number in the string that contains 0 I am asked to display it without 0.Example: 15 543 3...
[2 replies] Last: Version without functions: #include <iostream> int main() { std... (by JLBorges)
by tit0n
Infix to prefix that is already fully parenthesized
 
I've found a lot of pseudo code or codes in general where they do infix to prefix. But for my project the input can already be fully parenthesized. I am having ...
[no replies]
February 2017 Pages: 1234... 37
  Archived months: [jan2017] [mar2017]

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