Beginners - October 2014 (Page 15)

by Ganado
Will compiler ignore the return statement?
 
From discussions of i++ vs ++i, I realize that the compiler will indeed be able to optimize and get rid of the return statement if i++ is not being assigned to ...
[15 replies] Last: ..... has been optimised to a single statement: return 25000; All ... (by TheIdeasMan)
Class questions
 
Is this code Critter::Critter(int hunger) : m_Hunger(hunger) { cout << "A critter has been born!" << endl; ++s_Total; } same as this? Cri...
[1 reply] : For primitive types yes. For more complex types second version is equi... (by MiiNiPaa)
by mexi
Matrix class and operator+ function
 
I created a matrix class and want to add 2 matrix(2x2). My compiler(Borland C502) is successful. So it doesn't show result matrix. My error is copy constructor ...
[2 replies] Last: Line 17 The + operator doesn't need friend. http://www.cplusplus.com... (by mobotus)
by Atton
MathPad
 
I have been making efforts to create a calculator using C++. However with every project I make I hit a dead end somewhere often because I flat out do not unders...
[6 replies] Last: Thanks I might have hit the heart of the problem. (by Atton)
OStream Operator overloading
 
Why is it that I am still getting this error after I overload the operator<<? 2 no operator "<<" matches these operands operand types are: std::o...
[2 replies] Last: I see.. Thanks.. I got it now (by procastination)
What is left and right operand?
 
This is a dumb question but when i am reading a tutorial sometimes i see then left and right operand? what are those?
[1 reply] : X + Y Here X is the left operand of operator+ (as it is on the left ... (by MiiNiPaa)
by mexi
Overfloading operator* for matrix_vector multiplication
 
Hello everyone. I writed a program to multiply a matrix with a vector using operator*. When I compiled this program, it did not run completely. This warning is...
[5 replies] Last: Thank @ShodanDo, @Ispil very much. I repaired my program and it runned... (by mexi)
Play my game !
 
this is the source code of a game i created. it contains : -snail races -tic tac toe -calculator -random number generator the code is simple i used fu...
[6 replies] Last: in my Orwell Dev C++ (TDM GCC 4.8.1, ISO C++11) there is no single wa... (by MiiNiPaa)
by Musi
Initialize const global variable.
 
I've been trying to use const global variables but they never seem to be initialized even after main() has begun executing. I'm trying to create bit masks usin...
[4 replies] Last: Thanks a bunch JLBorges, I actually just found out whats causing the p... (by Musi)
enum class inside a class?
 
Is it okay to declare an enum class inside a class? Cause Strongly type enums has already a scope Should you invoke it like this? Myclass::Foo:Item? ...
[1 reply] : YES (by shadowCODE)
using letters inside while() and If() conditions
 
Hello, This program that I am trying to write is supposed to take in data from a user at a diving competition. This program is supposed to: 1. Prompt the user...
[3 replies] Last: change prompt from std::string to char . Also in line 46, y i... (by shadowCODE)
why to use pointers instead of this?and it has the same result?
 
why i should use: #include <iostream> #include <new> using namespace std; int main (void) { int i , n; int *p; cout<<"how many numbe...
[5 replies] Last: ... (by MiiNiPaa)
Need help with class
 
so i need a class that asks the user for their name and then returns "Hello<name>" so far this is what i have. the issue that im having is that it is only print...
[5 replies] Last: returnName is a datatype just like int or bool or string Would line 34... (by soranz)
Making a schedule using classes
 
Hello, I'm having a bit of trouble with my code, I'm trying to make a 7 day/ 24 hour scheduler. My plan to do do this is to first make a 2d array that is bla...
[3 replies] Last: Line 11 declares an array of 7elements (by 24) Then Line 19 attempts t... (by soranz)
Outputting a 2 digit number with a space in between using an array
 
Ok. Im working on an assignment were you're supposed to output a number using arrays. I have the code working but my number is mashed together in 1 digit. I'm s...
[8 replies] Last: Excellent! Cheers :) (by closed account 48T7M4Gy)
Sorting loop won't execute
 
I'm trying to sort a list of words alphabetically. I put in several nested loops, but I can tell none of them are running because there should be an output eac...
[4 replies] Last: Ok, so why are you still using constructs like this: [code firstline... (by TheIdeasMan)
Xcode Errors for C++
 
Hey there, so I'm a beginning program student and we have this assignment to build a program for a fish store. It's on the inventory. We cannot use classes. Any...
[1 reply] : Your problem is that you are not clear of how to create a function. Yo... (by liuyang)
Solutions
 
I am just practicing more functions. I would appreciate a solution to these two questions: 1) Write a function that takes as input an array of integers, its si...
[2 replies] Last: I did, but some of it doesn't make sense to me. I would appreciate if ... (by sarangheh510)
Detecting EOF when reading and writing
 
So I am doing an assignment for an online course, which involves recovering deleting jpgs from a camera memory card. I have written the program and it recovers ...
[5 replies] Last: Since this is a C++ forum, I'm going to give you a C++ answer: http:/... (by IWishIKnew)
by gmac
Write a program to generate the entire calendar for one year. The program must get two values from the user
 
Write a program to generate the entire calendar for one year. The program must get two values from the user: the year and the day of the week for January 1st o...
[14 replies] Last: That is convoluted... Yall are dancing around the meat of the issue b... (by IWishIKnew)
October 2014 Pages: 1... 1314151617... 70
  Archived months: [sep2014] [nov2014]

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