Beginners - February 2017 (Page 11)

How to implement a function that return two integers? (1,2)
 
I have the following code but it needs to have a function that has a vector as a parameter and return the maximum and minimum of value of n numbers. The vector ...
[20 replies] Last: Why not use references if you want to return multiple variables? Simp... (by mbozzi)
Ctime
 
When i use the header ctime and then write srand(static_cast<unsigned int>(time(0)); what does this "time" do?
[7 replies] Last: There are many alternatives to ctime that have a richer, more flexib... (by dangrr888)
Using classes to work with Mathematical Numbers
 
Hi, I am a very inexperienced programmer and in need of some help. My goal for this program is to add, subtract, multiply and divide complex numbers. Complex nu...
[16 replies] Last: Oh -- the problem is on line 49. Your overload for operator>> needs t... (by mbozzi)
Having a class for variables
 
Hey guys, I have variables that are used pretty much everywhere in my game. At the minute I have a class to hold all these variables and then i pass the object ...
[5 replies] Last: I have changed the way I have done it now, I decided to make it so the... (by DylanMorganx)
by nomat
Logic Erros
 
The standard deviation calculation on this program doesn't seem to yield an accurate result. Someone please spot the logic error here. Also maybe help neaten th...
[3 replies] Last: Mmmh ok will re-work this and see what results i get. The test input f... (by nomat)
Problem with while loop!
 
Why when i enter 'q' or 'Q' the while loop executes? char choice_fj(); int main() { int balls;int guess,guesses=0; char choice;choice=choice_fj(); ...
[2 replies] Last: aaaaaaaaahaaaaa yes i can't believe i did this again thx :D (by spax1111111)
by raminM
flipAround
 
How can fix this code so my assertions don't fail ? include <iostream> #include <string> #include <cassert> using namespace std; int flipAround(stri...
[2 replies] Last: sure thanks for the hint, I'm gonna get rid of the asserts and give i... (by raminM)
by rkarim
Pointer in array problem
 
Hello guys! I am new here and joined recently to show my simple problem because I am having final exam this week. My problem is whenever I introduce pointers i...
[3 replies] Last: arr there is no need to declare additional memory if you're not goi... (by gunnerfunner)
Help with implementing linked list
 
So recently, I started to learn linked list in class and I am confused. She did a whole explanation and some examples, but it doesn't make sense. So for example...
[6 replies] Last: You seem to have the code skeleton but otherwise I can't see much of y... (by Pattako)
Creating linked list from virtual class
 
Hello, I am trying to create a linked list that includes two types of subobjects. I'm struggling to explain this. Basically, I have a vehicle class and I am ...
[4 replies] Last: I've tweaked some singly linked list code I posted last week (sorry ca... (by gunnerfunner)
int array to char array
 
How would I convert an int array to a char array? Basically, instead of it printing a value, i was s3 to be "D", s2 to be "V" and s1 to be "H" void init...
[3 replies] Last: You could loop over the data and convert, OR you could cast it. int... (by Bdanielz)
Singly linked list
 
So recent, I started to learn linked list in class and I am confused. She did a whole explanation and some examples, but it doesn't make sense. So for example I...
[1 reply] : http://www.cplusplus.com/forum/general/209044/ http://www.cplusplus.co... (by closed account 48T7M4Gy)
cout not working in For Loop
 
I found this code at tutorialspoint.com and wanted to tweak it a little. It is supposed to print all prime numbers up to 100. I copied and ran it in code::blo...
[3 replies] Last: Try this now: #include <iostream> int main () { const int UBOU... (by JLBorges)
by NICE8x
Class derived from a derived class
 
I figured it out. However a circle class can be derived from an ellipse class.
[2 replies] Last: Hi, A Circle is not an Ellipse and vice versa, so one should not i... (by TheIdeasMan)
by Sentoo
For Loop Help
 
Hey guys, I do not know how I go about doing things after testing out things with this code. If you guys could help me out, I would gladly appreciate it. #i...
[9 replies] Last: Just an opinion, I'd consider ufrnkiddo's approach quite reasonable. C... (by Chervil)
How to turn off getline?
 
I have an assignment where I need to extract data from a file using getline and write it to a new file. I got that to work, but now I can ONLY extract string v...
[3 replies] Last: Sweet, I got it to work with my int variables. Doubles should be pret... (by givemeallthehelp)
The Average Of Three grades
 
I need help with my program.I have already started it but can't finish the program.The user is to input three grades and find the average of these three grades....
[2 replies] Last: I found some ambiguities in the way you represent the scores (if the s... (by ufrnkiddo)
by Lars V
problems using string substr()
 
I am trying to make a program which divides a string into words and shorter sentences. I want "Word1 word2 word3" to be pushed in to an array like this: {Word1,...
[4 replies] Last: Thank you! The initial idea was to do this with the find(), length() ... (by Lars V)
C++ Programming Help
 
The initial output of my program is: Dear potential adopter: What is your full name? input random name What is the name of the pet you wish to adopt...
[2 replies] Last: Thanks, it worked. (by StrikingSparrow)
External linkage doesn't work (1,2)
 
Hi, Facts: External linkage is make a type identifier visible in any translation unit. Non-static global variable has external linkage by default and stat...
[21 replies] Last: It helps to note the difference between a variables definition and i... (by dhayden)
February 2017 Pages: 1... 910111213... 37
  Archived months: [jan2017] [mar2017]

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