Beginners - October 2016 (Page 22)

Array multiplication
 
I want to multiply every 2 elements in an array then add it all up. And this array is pretty large so O(n^2) will fail. I think I should use divide and conquer ...
[6 replies] Last: My mistake for typing it wrong!! And thanks for the advice. (by tomtran3110)
How do I determine the highest and lowest values from a text file?
 
For part of my assignment I have to do what the title says. Here's the file's contents. 95 100 120 130 135 145 155 185 190 160 130 120 Wh...
[2 replies] Last: #include <iostream> #include <fstream> #include <limits> using names... (by closed account ybf3AqkS)
by G9C89
Multiplication help
 
Hi, I am kinda new to programming and I wanted to know.. 1.Let's say I have a variable x. (Int x) 2.Using a for loop I am letting the person to type 10 numbers...
[3 replies] Last: @Boilerplate , @integralfx, Worked like a charm, thanks! (by G9C89)
tracing functions inside of functions
 
Hi, I need help tracing how to get the value for y in the main function below. I understand how to get x and z. the output is x = 12 y = 108 z = 8 I as...
[1 reply] : Never mind I just looked at it again and realized x's value changed. s... (by monkeyPlusPlus)
stack class query
 
The program below is from a book I'm using to learn programming. While I understand almost every aspect of the code. I have a question. The program below ...
[2 replies] Last: Thank you Hirokachi, but if I have two stacks, how do I know which sta... (by avillageofbigheads)
Weekly Pay roll
 
My problem arises when hours or pay rate is 0 as an input but the program does not calculate it as a 0. I tried inputting 0 as the hours on the first 3 lines o...
[1 reply] : Program works fine. You just don't write to outfile when gross pay is ... (by vin)
set question
 
Can we use set data structure with pair of values? If yes, how would the values be sorted? Would it be sorted based on first value in the pair?
[3 replies] Last: Thanks @JLBorges, thats very helpful. (by funprogrammer)
Problem with maze generator not completing itself
 
I'm not too sure what the problem is at all, but what should happen is in the maze generation function I have 2 vectors, 1 for row, 1 for column. I set random v...
[3 replies] Last: @cire I'm not too sure what you mean by "valid" parameters. When recur... (by lilbigwill99)
by mtroll
How to detect if only numerical digits are present in strings.
 
Write a program which accepts a phone number in the form of a string and detects whether it's valid. The phone number is 12 digits long expressed as ###...
[8 replies] Last: #include <cctype> #include <iostream> #include <string> using names... (by closed account ybf3AqkS)
Question about class member function initialization...
 
Hello, I have been getting the below error from my code. PowerFlow_SecondAttempt.cpp:49:2: warning: no newline at end of file PowerFlow_SecondAttempt....
[2 replies] Last: Ah, I see that as well as my many mistakes. It works now. Thank you. (by EverGreen1231)
New to C++ Please Critique
 
Hello everyone, I just started looking into c++ a couple days ago and between Youtube and the tutorial pdf on here I think I'm doing well. I have created two cl...
[3 replies] Last: Awesome feedback, thanks to both of you! (by heintzman)
Reading / writing files / eof / setF / setW()
 
To start, I'm a beginner, so I apologize in advance. I'm trying to write a program that reads 2 sets of number form a file (int id, int calls)and sorts them int...
[1 reply] : My output example in my description got squashed when I hit reply.. I'... (by milzticket)
how to switch that will only show the passing remarks and the failed remarks
 
#include<iostream> #include<windows.h> #include<string.h> #include<iomanip> #include<iomanip> #include<conio.h> #include<math.h> #include <algorithm> #i...
[no replies]
Splitting code into separate modules
 
I've been trying to separate this code into different files, 2 headers and 3 different cpp ones, but keep getting errors. One of the main ones is array bound is...
[3 replies] Last: This seems like a very very bad assignment, however your biggest probl... (by jlb)
Vector
 
could someone explain what is avec.pop_back() ? i'm confuse on this code. or explain what going on would be great? the output is: 10 6 ********** ...
[1 reply] : http://www.cplusplus.com/reference/vector/vector/pop_back/ Removes t... (by booradley60)
Wierd error HELP
 
I'm writing this very simple code here and it should work just fine.. But i get like 50 errors in stat.h? such as: d:\mingw\include\sys\stat.h|180|error: '...
[2 replies] Last: For starters you seem to be missing several semicolons, and you also h... (by jlb)
C++ function help
 
Create independent return functions that calculate each planetary body independently. In main() create a menu that controls the program. The program should br...
[1 reply] : #include <iostream> int foo() { // do you see any I/O in this func... (by keskiverto)
HELP PLEASE!
 
I wrote this code last week and it is not entirely correct. I have to add Create functions based on your existing source code (ex. GetCar, CreateCar, CalculateL...
[9 replies] Last: I see and yes when I deleted the last paragraph it compiled with no er... (by channing0411)
Anyone know how to do this?
 
anyone know how to do this? I'm having hard time in my class.(c++) Modify the following program so that when run, it requires the user to enter the digits in t...
[2 replies] Last: Since SECRET_DATA contains just 0's and 1's you'd also need to restric... (by gunnerfunner)
Beginner issue with floats and doubles
 
I'm writing a simple algebraic expression and I'm trying to express the answer in a variable. I know the answer is going to be a decimal so I've declared the va...
[1 reply] : Get your code to write out the values of rightColor.green and leftColo... (by lastchance)
October 2016 Pages: 1... 2021222324... 51
  Archived months: [sep2016] [nov2016]

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