Beginners - October 2017 (Page 16)

switch statement with basic math problem
 
The issue i am having is initializing the math problem. cannot use string or if. must be able to just put in a simple math problem 8+8 and it will display the a...
[6 replies] Last: Your second switch is floating in vacuum. Clearly, the switch at line... (by Ihatov)
size of memory on the heap
 
Hi guys so after a bit of googling I have found that there is pretty much no way to find the size of memory of an array in the heap for example I dynamicall...
[2 replies] Last: Hello adam2016, Line 9 When you create the array with new you know th... (by Handy Andy)
Declaring function from one cpp file to another
 
hello, simple stupid question, for pros, i have 2 cpp files, 1 has a function, the other is the main function, the 1 cpp file that has the main of course needs ...
[3 replies] Last: If it's two ints: int Adding(int, int); If it's a string: void ... (by Ihatov)
by laenos
help with a function
 
I have to write a function to count the number of students who scored Y marks in GPA. The result should be stored in the array sum_gpa . The student can score f...
[4 replies] Last: Now I understand because it does not work. Instead, if you wanted ... (by laenos)
Help with Comparing Two Input Streams!
 
Delete!
[11 replies] Last: remove the edit button. (by ne555)
by RNBW
String Arrays
 
I am struggling to get my head around this problem. I want to prompt for say three responses (let's say three responses are First load, Second load and Third a...
[9 replies] Last: @jlb Thanks for your help. Now to read up on vectors! (by RNBW)
Iterate through a vector
 
The function should iterate through the vector listAccounts of type Account. And if the account_name in listAccounts = name, the balance of that element should ...
[2 replies] Last: Thanks! So I did that, and I got "0 accounts to check" Is this a pro... (by runrabbitrun)
how to overload the plus operator ?
 
I keep getting the error too many parameters for this operator function. #include <iostream> #include <string> #include <vector> #include <algo...
[8 replies] Last: you can try it out with my code. OK, here goes: #include <iostrea... (by Chervil)
out of bounds in game
 
Hi guys I made a game in which you can move up down,left and right in a console the X is the current position you are at and I will implement a random position ...
[8 replies] Last: @lastchance nice spot =) changed the random numbers, thanks (by adam2016)
how to sort rectangle by area in descending order ?
 
I am trying to write a code that sort rectangle by area in descending order. For some reason when i run this code, it sorts it in ascending order instead. ...
[1 reply] : How do you know that? Where do you print the sorted vector? (by keskiverto)
question mark at end of for loop
 
Hello everyone i'm trying to figure out what is the use of the question mark (?) inside the brackets on the last assignment statement, i wonder if it's a typin...
[1 reply] : See Conditional ternary operator http://www.cplusplus.com/doc/tutori... (by Chervil)
Creating a bunch of preset combos of settings in a class
 
I have a simple class and I would like to create a bunch of value presets so user can easily switch between them struct settings_batch{ int a; int b; float c...
[no replies]
Getting averages from data from txt file
 
I have been given a text file that contains 365 lines, 1 number on each line. Each number is the amount of steps someone took per day for a whole year. The task...
[2 replies] Last: There's no need to look too far ahead. Build up the code in stages. ... (by Chervil)
Need help with Machine Problem!
 
Below is the exact description and requirements needed for my machine problem. Below I have attached the code for this problem that I have written up thus far....
[2 replies] Last: else if (profit > max_Profit) { max_Profit += profit; Ouch!! ... (by lastchance)
by chuvak
Validating phone numbers
 
Say I have an array, long long phoneNumbers = { 1416123456LL, 14161234567LL, 1416234567890LL, 14162345678LL, -1LL, 124163456789LL, 14161230002LL }; ...
[2 replies] Last: Something like this: #include <iostream> bool valid_phone_number( lo... (by JLBorges)
mergefiles code behave badly
 
I cant understand what is happening and why it is not letting me enter more lines #include<iostream> #include<fstream> #include<string.h> using namespa...
[4 replies] Last: See: http://en.cppreference.com/w/cpp/io/basic_istream/ignore The 100... (by JLBorges)
by Bopaki
I have created a new project but I still cannot make it to see the list
 
This is the part that gives the error message: #include "listType.h" #include "arrayListType.h" #include "orderedArrayListType.h" template<class elem...
[4 replies] Last: I think I have posted everything. Please help (by Bopaki)
this-> not working
 
hi guys this is probably a very simple error anyway I am having a problem with using this-> in my initialiser list I checked on the forums to see if any...
[4 replies] Last: very good point Andy =) thanks (by adam2016)
2 integers on the same line
 
i want to know how to enter 2 numbers(the inputs) on the same line and separated by space like this the output is: Enter 2 integers: 3 5 but when i use this ...
[6 replies] Last: yes.Your second method is best as one is clear that he/she is enterin... (by closed account 1vf9z8AR)
by ericM
making a random generator global
 
I have to generate a set of random numbers supported by different distributions. I wish to use the ones provided by the STL, although I don't like the idea to...
[6 replies] Last: Thanks a million. (by ericM)
October 2017 Pages: 1... 1415161718... 33
  Archived months: [sep2017] [nov2017]

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