Beginners - November 2018 (Page 19)

Count how many votes a number has
 
Hi, I am wondering how would I go about counting the amount of votes a certain number has in an array. I have 100 random numbers between 1-3 and I need to co...
[4 replies] Last: SamuelAdams: I don't think sorting is appropriate here. It would almos... (by mzimmers)
optimized this code (1,2)
 
#include <iostream> using namespace std; int main() { int t; cin>>t; while(t--){ int flag=0; int n; cin>>n; int a[n...
[24 replies] Last: tpb , I'm not solving the problem, that post was off the top of my he... (by dhayden)
A number of errors, all on one line
 
Hello! I've recently borrowed a textbook from a friend so I may practice coding using the examples listed, as I've been wanting to get into coding for some time...
[3 replies] Last: Oh, bless you. I thought I put commas there before and it came up nil,... (by Mobliterated)
format ‘%s’ expects argument of type ‘char*’
 
I am running a program that initializes a vector full of integers, assigns randomly generated integers to it, does a bubble sort on the integers, and then finds...
[3 replies] Last: Peter87, that did the trick! Thank you! (by vaderboi)
Can not erase other non alphabet characters without going out of range
 
I'm supposed to get a string with spaces, numbers, or punctuations to become alphabet characters only. When I run the function it says I am out of range. For e...
[5 replies] Last: http://www.cplusplus.com/reference/cctype/isalpha/ If done from scrat... (by lastchance)
by kmce
Advice on learning programming
 
Hi, so I am in my second year of uni, learning programming, and i feel like I am not getting anywhere, seems to be a waste of money. I am in my second year and ...
[11 replies] Last: ..I wasn't sure how I would keep track of the amount of days of not c... (by Thomas1965)
by AL88
undefined reference to Array::operator[](int)
 
Can someone help me fix the error on line 61 thanks. #include <iostream> const int defaultsize = 10; class Array { public: // constructors ...
[1 reply] : You nee to implement these member functions that you declared. in... (by Ganado)
arguments to main( )
 
Hello there, can someone tell me why I need the '*' operator in the argument list of main ()? Does that mean argv stores pointers that point on char variabl...
[10 replies] Last: I agree with jonnin. Being familiar with both Windows and Unix/Linux i... (by Ganado)
Increase vector with while loop
 
I want to be able to have the numberSorting.at increase with each loop, but I can't figure out how to do that. Any suggestions? #include "pch.h" #includ...
[2 replies] Last: Thank you! (by amanseau)
by ashwyn
Help with Decimal - Binary conversion ?
 
Hello. This is code for testing a function that will be included in a larger program. I'm trying to take an int from the user, then convert it to the equi...
[4 replies] Last: I prefer the recursive version, but this alternative fixes the string ... (by lastchance)
by AL88
why is my template specialization not working?
 
I'm trying to fix the error on the line "Felix.append( Felix );" by ajusting the function and peoviding a template specialization like the compiler told me. I'm...
[5 replies] Last: Line 29 to 34 doesn't make sense. Remove it. Instead put appen(...) in... (by coder777)
Using Pointers with a Class
 
Hello, so this code was working in my compiler, but sometimes I would get an error message. It's weird because only occassionally did I get the error message, a...
[2 replies] Last: It's not likely to be “11 db”. Arguably, it's “lldb”: https://... (by Enoizat)
one Question
 
Cơn sốt mang tên Mua nhà mặt phố Hà Nội trong lĩnh vực đầu tư còn thu hút nhiều khách hàng hơn là mua đô la để tích trữ Trê...
[1 reply] : That is inheritance, but ... Public inheritance means IS-A relationsh... (by keskiverto)
Tired of trying
 
Hello. I need help with a problem. The task is : The user inputs a number n, and the program must find the first number bigger than 2010 whose sum of the dig...
[11 replies] Last: Thank you, when I go home I will fix it and let you know if I have mor... (by gabrinka)
Program to display shapes?
 
So, I'm trying to write code for a program that outputs stars (*) and spaces to create shapes based on an integer the user inputs. I was given a template in cla...
[1 reply] : You have given the sizes (int n) for each shape, so you need to code i... (by nuderobmonkey)
determining if 2 values are positive prime values
 
this is my first c++ class. both values must be positive, if its negative it will output an error and make them input 2 new values. and after getting both val...
[4 replies] Last: so you are saying to delete this line if ((p > 0) && (q > 0)) and... (by senkovlad16)
by fedegp
Lambda Function returning double
 
Hello to everybody, I'm trying to create a class which contains a lambda function which is defined in the main (The code is written below). #include <iostre...
[2 replies] Last: Thank you very much. Now it wors. So in this case, putting "return 2" ... (by fedegp)
[1st year University Comp Sci] Using a ManagedArray and a GuardedArray to create a Polynomial class
 
I've been tasked with creating a C++ class called Polynomial that applies different mathematical formulas to Polynomial I was given 4 separate bits of code and ...
[1 reply] : Example polynomial: a*x^4 + b*x^3 + c*x^2 + d*x + e ItemType foo {... (by keskiverto)
Directed Acyclic Graph
 
So I am studying graph data structures and I want to implement DAG but I am facing one problem, I want to make a DAG using randomly generated vertices and edges...
[2 replies] Last: To create a random DAG you create a random proposed edge. Let's say it... (by dhayden)
Please help me out of the problem.
 
Hi, I practiced programming c++ with visual studio code on Mac. But when I tried to debug the code as below, it always come out with "failed to open file!". It ...
[2 replies] Last: fopen() will set errno to tell you exactly what went wrong. #include ... (by dhayden)
November 2018 Pages: 1... 1718192021... 24
  Archived months: [oct2018] [dec2018]

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