Beginners - February 2019 (Page 22)

by NKGold
It won't work
 
So the program is suppose to read three number hat are separated by commas and output the sum of the three numbers for example, Input: 1,2,3 SUM = 6 ...
[3 replies] Last: How exactly are you entering the values? After changing the type to ... (by jlb)
Rounding to two digits and stop program from following two if statements
 
So it's been a while since I've done some coding and I've just got back to it after 4 years or so and I don't know what I am doing wrong. For starters, I am try...
[6 replies] Last: @chicofeo, Obviously English is not your first language. You've misund... (by dutch)
String manipulation
 
Write your question here. Can somebody help explain to me how to do string manipulation using substr() or find()? I feel like it is simple and I'm just over th...
[4 replies] Last: #include <iostream> #include <sstream> #include <string> #include <ve... (by lastchance)
LF Prime numbers
 
I'm trying to find how many prime numbers there are in a file. But so far something is wrong I believe that something wrong is with my function down below. Gave...
[1 reply] : Hello DdavidDLT, When I started working with the program Ii found tha... (by Handy Andy)
tridiagonal matrix inversion
 
May I know anybody here kindly can share tridiagonal matrix inversion? Thank you.
[9 replies] Last: Dear lastchance(2887), I realize that this technique will give me vec... (by nurulhudaismail)
Ascending, descending sorting wrong numbers
 
Hi, I've got a problem with my code. It should show the random numbers in descending and ascending order, however sometimes it shows 0 at the first position ...
[1 reply] : Your arrays WILL be accessed out of bounds on lines 72 and 117, becaus... (by lastchance)
12 Compiler errors found in my code :(
 
I am not sure why my program is generating these errors. Line 24 especially since I worked with a tutor I did not expect these errors. What am I doing wrong. I ...
[9 replies] Last: You cannot write functions that use Node unless you know how the Node ... (by keskiverto)
by Bopaki
What does this line mean or do in this example program
 
This is an example program from DS Malik textbook. The program works 100% OK!! But of interest to me is this line of code: newString(int i0, int i1); /...
[1 reply] : It's a member function prototype for the constructor of the class. J... (by Grime)
Getting "inf" and don't know why
 
I am trying to compute e^x and have made a factorial function that I verified is correct. The factorial function is not shown. I suspect the error is in the for...
[9 replies] Last: Please use code tags. If you want exp(x) - or most other power series... (by lastchance)
How to find a sphenic number
 
bool isSphenic (int numbers){ int i,j,arr[numbers+1],ans ; arr =0 ; arr =1 ; ans=0 ; for(i=0;i<=numbers;i++) arr =1 ; ...
[2 replies] Last: Factorise your number by scanning from 2, 3, ..., sqrt(N). Divide out ... (by lastchance)
seperate functions that open/close files
 
Hi, I have a quick question. I need to make two seperate functions that open and close a file. Normally I would make something that looks like this: std:...
[5 replies] Last: awesome, thank you! (by lovebug)
Is this code causing a memory leak?
 
I'm not sure if delete is actually de-allocating memory or if it's just calling next's destructor and re-pointing 'next' to nullptr. #include <iostream> ...
[4 replies] Last: Singly or doubly linked has nothing to do with it. The problem is call... (by dutch)
Passing by value
 
Hello! The output of this program is 5 and 125. But if I write only "cubeByValue( number )" i.e just call the function on 9th line, then output is 5 and 5. Why ...
[5 replies] Last: Bundle of Thanks! Stay blessed! (by lost110)
by bzarr
Switch statement won't break and instead loops forever
 
For some reason when I run my program, the switch statement wont break and instead loops infinetly switch (choice){ case 'a': ans=x+y; ...
[3 replies] Last: @Grime and @Uk Marine thanks for the help I noticed I had put the swit... (by bzarr)
vector of vector
 
hi.i wanna define a vector of vector that have not certain member.actually i have two variable that show the rows and the columns and a third one that i want pu...
[12 replies] Last: @ Grime unfortunately it was the first time that i used a vector and i... (by closed account y3091hU5)
vector of array
 
Here i have a code that works wrong! But i can't understand what's wrong. int main(){ const int NrSamples = 4; int NrEvents; std::ifstream input("Data_Test.t...
[11 replies] Last: @lastchance i know that j=5 is out of rang but my code will be use by ... (by closed account y3091hU5)
TIC TAC TOE GAME (SIMPLE)
 
I HAVE IT LAID OUT BUT SOMEWHERE I WENT WRONG WITH THE CODE THAT ONLY THE X APPEARS... CAN SOMEONE POINT IT OUT AND CLUE ON HOW TO FIX IT #include <iost...
[14 replies] Last: You're not doing a bad job at all for a newbie. I have some suggestio... (by Grime)
problem with looping and updating variables
 
I've having troubles trying to word this but basically my goal for the program is to have multiple people input how much change is in their pocket from toonies ...
[3 replies] Last: A helpful link for vectors is https://www.geeksforgeeks.org/vector-in-... (by chicofeo)
Passing an array of numbers to a function
 
I am trying to find if the numbers from a file stored in an array are perfect numbers #include <iostream> #include <fstream> using namespace std; bool i...
[3 replies] Last: #include <iostream> #include <fstream> bool is_perfect( int number )... (by JLBorges)
by NKGold
I need some explanation
 
How can I make a program that can read multiple non-whitespace characters and form a string using the string .push_back() function. This has always confused ...
[5 replies] Last: #include <iostream> #include <string> int main() { const std::si... (by JLBorges)
February 2019 Pages: 1... 20212223
  Archived months: [jan2019] [mar2019]

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