Beginners - January 2018 (Page 3)

by vitcal
Reshape vector
Hi, my task is to reshape a vector in order to build a matrix. In particular, let say i have a vector of n elements. Knowing that the number of element n = a*...
Jan 30, 2018 at 5:41am
[10 replies] Last: > to reproduce something like matlab's reshape boost::multi_array doe... (by JLBorges)
by Millet
Homework
I can't get the below code to compile and run, I keep getting a LNK2019 error in visual studio. Does anyone know why this is? The goal for this question is to t...
Jan 30, 2018 at 5:02am
[7 replies] Last: It doesn't print anything because the code fails to compile. (by closed account E0p9LyTq)
Personal project: else/if statement problem
Hello, This is just a personal project and the problem is when ever "rtd" equals to 10 I get both of the if and else statement text is put onto the display, I j...
Jan 30, 2018 at 4:31am
[3 replies] Last: Look at line 38. What's wrong? Multiple problems with it. (by closed account E0p9LyTq)
Help With Average
I have been doing this project for an assignment and every time I run it with any 3 numbers as the grades, the average comes out as a huge negative number, as i...
Jan 30, 2018 at 2:17am
[3 replies] Last: You're welcome. I highly suggest using what's called a "debugger", whi... (by Ganado)
HELP!!
Hey all, hope you are doing good. I have a question to ask and it has been bothering me for a while now and I can't seem to figure it out. So i decided to creat...
Jan 30, 2018 at 1:31am
[3 replies] Last: Yeah, something is really wrong with my logic, but thanks so much joe8... (by CrixStixs)
if/else only giving else cout message
I'm very new to c++ and I was told by a lecturer to experiment with it at home, I'm using the if/else statement but no matter what is types i am getting the els...
Jan 29, 2018 at 10:33pm
[2 replies] Last: that seemed to work thank you so much! (by Alldeezwaffles)
class and overloading operators
Hello guys, i am new here and just have begun to programe a little bit so there is something i dont understand i hope you guys can help me with it: its abot a...
Jan 29, 2018 at 8:54pm
[3 replies] Last: One way to do it is declare friend ostream& operator<<(ostream& oss... (by jlb)
Giving an array in form of pointer to a function as parameter
Hello guys, I need to give an array to a function. Different functions will give this function arrays of different sizes, so i decided to take a pointer. He...
Jan 29, 2018 at 8:52pm
[4 replies] Last: @ jlb, Also size_t is an implementation defined unsigned type, usual... (by Handy Andy)
by Zoren
How to use do while loop to display menu?
Hi everyone! I'm new to C++ and this is what I coded in the last few days: #include <iostream> using namespace std; int main() { int choice ...
Jan 29, 2018 at 6:10pm
[6 replies] Last: Hello Zoren, This is something I like to do. See if it meets what you... (by Handy Andy)
Just one string member shared by all objects
With this, with each new objetct i'm creating an array of four pointers to four literal char strings: class Seasons { const char * const SEASONS = {"Spr...
Jan 29, 2018 at 2:00pm
[4 replies] Last: C++14: If a constexpr static data member is odr-used , a definitio... (by JLBorges)
by Dr4g
Problem with scanf_s and printf.
Hi everyone,I'm a beginner at this and I was doing some exercises,but every time the result was some big weird number,so i thought "Why don't I write this simpl...
Jan 29, 2018 at 1:19pm
[4 replies] Last: You're welcome - glad I could help! (by MikeyBoy)
dynamic arrays
my program must ask a user to enter the size of the array that stores exam marks. create the array and a loop that allows the user to enter an exam mark. then t...
Jan 29, 2018 at 1:09pm
[2 replies] Last: Thank you, my program works perfectly now. (by sphinxxx69)
Why do I only output 2 items from my linked list despite creating multiple structures?
Hello, I am writing a simple program that works as a telephone directory but in a doubly linked list format. I am unsure why I am only able to display 2 ite...
Jan 29, 2018 at 9:54am
[1 reply] : The problem is on line 169. Instead of setting pcurrent->nextaddr to... (by coder777)
number of occurrences
My program is supposed to read the number of occurrences of a word from a text file but it doesn't work and i don't know what's wrong with it. #include<ios...
Jan 29, 2018 at 9:50am
[2 replies] Last: 1. Check that your file actually opened. Yes, really! 2. Use std::stri... (by lastchance)
Meaning of "&" operator in this context?
Hello, I've bought the book, "Professional C++" as a way to teach myself more about the language and I keep seeing the & operator used. I assumed that they were...
Jan 29, 2018 at 9:23am
[2 replies] Last: First, please post code with code tags. See http://www.cplusplus.com/a... (by keskiverto)
by ebba
HW
It only outputs to 2 digits! So, in the example below, it outputs 2.25. Not sure what's going on. I'm sure it's something silly... If anyone knows and care...
Jan 29, 2018 at 8:23am
[2 replies] Last: - You use newApprox on line 18 without initialising it. - You never ch... (by lastchance)
HW help
I am attempting to write this code for class. However, when I submit the code, I keep getting back a 0%. I don't understand why. It runs, however, I still get a...
Jan 29, 2018 at 3:09am
[7 replies] Last: Thank-you so much for your help. I completed the assignment. It turns ... (by Wholetruth)
my while loop doesn't stop
i'm writing a program that classifies positive integers as odd or even but when I type a number the loop doesn't stop. It will say even or odd depending on the ...
Jan 29, 2018 at 12:42am
[1 reply] : x doesn't change within the while loop, so the loop either doesn't run... (by dhayden)
I need help with .txt input, can someone help me?
The basic concept of this code is that you take input from a .txt file about The type of operation you want to do, the first number and the second number (It's ...
Jan 29, 2018 at 12:26am
[8 replies] Last: Oh okay, i got it. Thanks for your help! :) (by Luca Strano)
Strange console/pointer behaviour
I am working on a bit of code that includes arrays in and out of functions, but my programs insist on some very strange behavior that persists regardless of my ...
Jan 28, 2018 at 9:37pm
[4 replies] Last: It's important to understand the difference. Your randomizeArray funct... (by Ganado)
January 2018 Pages: 12345... 22
  Archived months: [dec2017] [feb2018]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.