Beginners - February 2016 (Page 2)

Class Templates
 
Hey guys, wrote this program with class templates to get the area of a rectangle. I placed it in a loop so the user could reset or end the program, but my teach...
[1 reply] : You should place a break; after the cout on line 71. Apart from tha... (by coder777)
Object method error says non-const must be an lvalue.
 
Hi so I'm receiving an error that I have not yet encountered that says " Initial value of reference must be an lvalue" I am trying to write the implementation o...
[1 reply] : The class function Stack::push takes the following parameters: (List<... (by Moschops)
Program to calculate interest isn't working.
 
This program is designed to calculate interest but it gives me the initial investment three times in a row for some reason. Anything stick out to you guys? Than...
[6 replies] Last: I'd suggest using just one function and pass the number of days as a p... (by Chervil)
Function and struture
 
Hi guys, I need to write a c++ program which i will mention below. I have only manage to start on the structures and do not know how to continue, been searching...
[no replies]
questions regarding arrays and structure
 
i have some question regarding arrays and structure. Q. a condominium has 3 BBQ pits available for booking.you are tasked to design and develop a program to ...
[no replies]
Please tell difference between copy constructor
 
What is the difference between copy constructor and default copy constructor. and class dis{ int x,y; public: dis(): x(10) y(20) { } // dis() : x(1...
[1 reply] : What is the difference between copy constructor and default copy cons... (by TheIdeasMan)
exiting loop upon negative number
 
solved
[5 replies] Last: @ curiousfloridian Could we ask you not to delete your question once... (by TheIdeasMan)
calling a function from one class to another
 
I am trying to make the game tic tac toe. I am suppose to have two classes one called board where the board is created and the moves are made. The other class i...
[4 replies] Last: I think you misunderstand. In the main function, you create an objec... (by sasauke)
How would I get the length of the last word in a string of input?
 
Write your question here. I know how to get the length of one word or the length of all words in a single input string. But I have to get the last word which c...
[1 reply] : Try world.length (by papagym177)
by sya20
how to use 2D array, 'if' statement and 'for' loop
 
I have no idea on how to make a 3x3 and 4x4 2D array and also using the 'if' statement. I also need to use 'for' loops for this assignment. My question are what...
[5 replies] Last: It almost seems as simple as adding braces ('{}') around your code... ... (by WakeofMisery)
morse code translator PLEASE HELP
 
This is for an assignment and I can't use c++ strings... Only c-style strings. Any help on solving this problem would be great! Errors I'm getting: a5.cpp...
[1 reply] : Use the thingie on the bottom right so it isnt a pain in the eye pls... (by MaBunny)
How to print with two figures to the right of the decimal.
 
Hey all. Got a program to run fine, but I'm having to print it in dollars and cents. However, obviously anything other than an int prints multiple places beyond...
[3 replies] Last: #include <iostream> #include <iomanip> double get_interest( double a... (by JLBorges)
Problems with my calculator
 
I keep getting errors in the following code (I will be posting the errors at the bottom of the code): #include <iostream> #include <stdlib.h> #include <con...
[3 replies] Last: Both n1 n n2 are int types try using this : cout<<(float)(n1/n2)<<e... (by MaBunny)
number of divisors
 
Since I am terrible at summarizing here is what I need to do "Write a function - maxDivs() - that takes two integers such as low and high and assigns the inte...
[1 reply] : #include <iostream> // returns the number of integral divisors of nu... (by JLBorges)
Help Scanning document
 
For an assignment I have to create a program that reads two files. One (Student data file) containing multiple students' ID #s, semesters courses was taken, cou...
[no replies]
can't get 3 lowest values to print correctly
 
I can't get my randomly generated multidimensional array to print out the 3 lowest numbers correctly. I thought I was onto something, but I guess not. It finds ...
[5 replies] Last: nevermind guys I got it!! thanks again (by misslyss)
cout behaviour
 
I'm opening a file and reading through it line by line, printing each line to the console. If I do not put some sort of newline character at the end of each cal...
[7 replies] Last: If you use a text file created on a windows system and try to use it... (by RadWayne)
Loop help
 
So I'm given 2 tsv files StudentData.tsv and ClassData.tsv. In StudentData.tsv, it displays what classes the student took and their grade in that class. In Clas...
[3 replies] Last: So are you able to use functions? My suggestion would be to read the ... (by Chervil)
Conversion table
 
Dear all, I tried to get the program below running but I could not. I think slash is creating problem. Any help appreciated. #include <iostream> usi...
[1 reply] : Line 6, that '/' is not a legal character for creating variables. You ... (by newbiee999)
opening/reading from a file
 
Hey guys, I cant get this file to open and Im not sure why. Any help would be appreciated string fname, lname; int month, day, year; string text; ifstrea...
[1 reply] : change lines 4 and 5 to these: ifstream myfile; myfile.open("preside... (by newbiee999)
February 2016 Pages: 1234... 46
  Archived months: [jan2016] [mar2016]

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