Beginners - November 2019 (Page 9)

Can I have range in switch case in C++?
 
Hello, I have a float number and I want to use a switch case for this. To solve float problem in the switch case, I multiply the number to 10. But for ra...
[5 replies] Last: @lastchance, actually, after having posted it, I realized it was a ver... (by Enoizat)
by ipak
Console shows up output is not there.
 
I am outputting some fractions which are stored in classes with two variables for numerator and denominator; however, the output I am requesting using cout is n...
[5 replies] Last: reduce() should take no arguments. It should just reduce the Frac th... (by dhayden)
Align Diamond in C++
 
Hello, I wrote a program to draw a diamond in C++. I have a problem with the first and second rows. the first and second asterisk isn't aligned. I upload my out...
[6 replies] Last: If you change the first k loop to for (k = 0; k < max(2*i,1); k++) ... (by lastchance)
Easy C++ coding
 
How do I do this 1.Declare the variables double circleRadius (radius of the circle), and double shapeArea (calculated area of the shape). 2.Please use M_PI fo...
[4 replies] Last: #define _USE_MATH_DEFINES #include <cmath> #include <iostream> int ... (by deleted account xyzzy)
Load Menu into Arrays, Print Menu, Get Order, Print Receipt
 
We learned about arrays for less than an hour and our professor wants us to write an ordering system that is divided up into several smaller functions that: ...
[no replies]
Use one fstream object to write and read on two files
 
Hello everyone, I'm trying to do the following using fstream class - read from the first file - write or read on a second file based on the user's input I ...
[13 replies] Last: It's okay to bump a topic, this isn't exactly a fast forum. We don't h... (by Ganado)
Name Arrange and Sort
 
Hello again! I have written a code for this using only int main(), and I need to break this code down into functions. But I am having issues with trying to read...
[18 replies] Last: jonnin, you're absolutely correct. I mistakingly figured this out by a... (by CodeNovice01)
Shape Volume/Weight decider using functions
 
I have written this program which is testing the use of functions and aims to take in 3 inputs weight, length and diameter of a shape and validates them. Next a...
[4 replies] Last: Ok got it working now, thanks man (by VictoryCFC)
Query: Priority Queue Natural ordering of strings
 
Dear C++ community I kindly want to inquire, what natural ordering strings use when being printed from a priority queue. I am questioning alphabetical natura...
[11 replies] Last: [quote=coder777]It is. And that makes the situation even worse […omi... (by Enoizat)
Find in vector
 
I need to find a substring. #include <vector> #include <string> #include <iostream> #include <algorithm> using namespace std; int main() { int ...
[7 replies] Last: @keskiverto apologies, even now, I'm not sure what the real intention ... (by malibor)
by Hay9
Variable to be constant after 1 input & return
 
Hello, I programm an account programm which stores name and password for a new account in accordance to different rules. 1. Question on constant variable ...
[3 replies] Last: > It is for me unclear how to separate the header and source. Header:... (by JLBorges)
by Ch1156
Setting struct variable in class object parameter list
 
I am just writing and playing around with some code and I wanted to have a word represent a number in the parameter list of my class object, my numbers are ints...
[4 replies] Last: I'll look over your code, I never use templates, probably should learn... (by Ch1156)
How can the Lambda expression be modified to put string in text file?
 
Dear all, I have a code, with that I can show the out put on the screen. But, I want to put the output in a text file. Frankly, I read about the Lambda express...
[7 replies] Last: Dear jonnin, so many thanks for your help. It works for me. And now I ... (by leelion)
Trying to find the average array
 
Write your question here. Hello folks, I am not able to find the average arrays from my .txt file. Is there any solution to this? Thank you for your time! ...
[4 replies] Last: To print the monthly average, you go through the data accumulating sta... (by dhayden)
Pascal's Triangle function giving me an error
 
I am using Visual Studio , and have the following code for my Pascal's Triangle function: #include <iostream> #include <stdlib.h> #include <fstream> #include...
[7 replies] Last: up to a certain point, pow(11,row) works too :) where row = 0...4. ... (by jonnin)
Issues with potential stack overflow.
 
I'm working on a homework assignment that I've worked out successfully in each function except the last. My last function breaks/overflows the output of all my ...
[2 replies] Last: I swapped the '\0' for size-1 instead and now we're rockin and rollin.... (by Snickelfritz)
How to declare array with no constant variable?
 
How to declare an array with no constant variable? like: cin << a; int Mass ; I want to write a programm that take all numbers in bunch of arrays and delete du...
[5 replies] Last: if you cannot use anything other than arrays, this problem is annoying... (by jonnin)
Vector and strings
 
How I can input words invector? #include <vector> #include <string> #include <iostream> using namespace std; int main() { int n; vector<char>w...
[4 replies] Last: Great, thank you! (by victorio)
Java Program to C++?
 
So I'm trying to change this Java program to C++ but have the same result, and compilers haven't been working correctly for me... Estimate p) p can be comput...
[5 replies] Last: Hence the reason I'm in the beginner forums... (by TheSkyWookie)
Undefined error - but I added the header file OK
 
Hello C++ professionals, I am getting an error below. I have searched online for this solution, but I cannot see where the problem is since I added the header f...
[2 replies] Last: That's a linker error. It has nothing to do with the header file. It... (by MikeyBoy)
November 2019 Pages: 1... 7891011... 17
  Archived months: [oct2019] [dec2019]

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