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*...
[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...
[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...
[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...
[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...
[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...
[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...
[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...
[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 ...
[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...
[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...
[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...
[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...
[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...
[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...
[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...
[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...
[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 ...
[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 ...
[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 ...
[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.