Beginners - February 2019 (Page 13)

Object with constructor as member of another object
 
Hello, I'm Angela and I'm new to the forum and the C++ programming language. Suppose I have a class Engine like this: class Engine { public: Engine(/...
[2 replies] Last: I mean, of course it's that simple! hehe thank you sir! :) (by Angela1998)
columns and rows
 
I am trying to figure out how I would store the values for the total cols and rows so my print_array function would output them. I am having issues understandin...
[8 replies] Last: In both of your totalling routines you have declared i, j to be double... (by lastchance)
Find index of an element within the array
 
I have the following function: template <typename T> size_t FixedVector<T>::find(const T& value) { // to be completed size_t index_ = 0; f...
[2 replies] Last: Thank you so much. I did what you told me and it works now. (by bbsmiley)
My code skips the first line
 
When I'm running the code it runs but it skips the first line of entry and I'm not sure why. I've tried looking up for solutions like cin.ignore() but it seems ...
[5 replies] Last: Thanks guys this is helping me learn. (by chocotaco)
Extend dynamic array of pointers
 
Let's say we have class Example.With a constructor we initialize n pointers,but later in the program if we just want to extend that array,what is the best thing...
[4 replies] Last: Thanks for your advises.We must use dynamic memory allocation this way... (by Zivojin)
by Cairus
Object and Class Issues
 
In this code I got age to work, but I think im misunderstanding HOW it works as I am trying to get it to also do weight but am running into a bunch of different...
[2 replies] Last: It is a very good thing to learn to debug because as you improve your ... (by Zivojin)
by Maria2
C++ more then one max values (1,2)
 
Is there any C++ function that returns the highest value s in an (int) vector, e.i. {4, 0, 2, 4}? Hope there is a function that can return: "The highest val...
[25 replies] Last: f = count(vs.at(i).begin(), vs.at(i).end(), alpha ); alpha is the s... (by Maria2)
by NKGold
I cant find the error
 
After I wrote this program I got a a lot of error messages but I cant find where I went wrong. #include <iostream> #include <string> #include <cstring> ...
[4 replies] Last: Thanks, that worked (by NKGold)
search word in file: i get different output like i want (1,2)
 
hello everyone, i know this is very messy but i have a problem searching a word. i want to search my text file user input : part output should only be "part" ...
[20 replies] Last: You cna make some function that comapes two words letter by letter and... (by Zivojin)
Reading in string and passing data to an array
 
I have a text file filled with decimals and I am trying to pass that data from the text file into an array. I have succeeded with reading in the data from the t...
[5 replies] Last: #include <iostream> #include <fstream> // accept all streams, not ju... (by keskiverto)
My Min and Max Values are displaying as '0.'
 
Hello, I am currently working on a project that requires the maximum and minimum of four randomly entered numbers to be outputted. I seem to be on the right tra...
[4 replies] Last: I appreciate your help guys! (by FreeThinker)
I can't run this program with values >5
 
#include<iostream> using namespace std; int c,d; int func(int a,int b){ if (b==0){ c=1; } else{ while(d<=b) c=c*a; a++; ...
[3 replies] Last: A value of 6 will cause you to enter your while loop, which leads to a... (by Ganado)
by ramp00
Struggling to cout vector when using classes
 
I'm currently trying to make a blackjack game, and I try to cout different values to check if I'm on the right path. I'm new to classes, and I don't really unde...
[4 replies] Last: That cleared things up a bit. Thanks! (by ramp00)
Using a while loop to write to a file
 
Is it possible to use a while loop to continuously write lines to a file and quit when you're finished? Or do you have to use a for loop? #include <iostre...
[17 replies] Last: Thank you for the explanation. I believe I understand now. I just crea... (by nicholasjb1996)
Previous exam question
 
Hey guys, This is an exam question that was on a previous exam for my programming class a few years ago made public for us to practice. Could anybody help m...
[4 replies] Last: If you don't have the rest of it, I would find a better problem to wor... (by jonnin)
Error C2360
 
Keep getting error C2360 and C2361, it basically skips ''nummer''. #include <iostream> #include <iomanip> #include <string> using namespace std; std:...
[4 replies] Last: Hello Normal student, PLEASE ALWAYS USE CODE TAGS (the <> formattin... (by Handy Andy)
equal bool help
 
Hello together, i use this if(equal(nochmal, "Ja")) but how can i use this so it is NOT EQUAl nochmal "ja" ? Thanks in advance
[2 replies] Last: if equal() is a user-defined function, if(!equal(nochmal, "Ja")) { } ... (by Grime)
Sorting array
 
Hey I dont know what is wrong with my code. It can run but doesnt do what I want it to do, which is sorting values of array from small to large number. It just ...
[2 replies] Last: hey thanks Jlborges (by thejogger1998)
eliminate the character
 
Hello, does anyone know how to eliminate the character? left only number and words #include <iostream> #include <sstream> #include <fstream> #include...
[8 replies] Last: bool remover(char c) { return (c=='.' || c=='\'' || c == '\"'); }... (by jonnin)
String accept both upper and lowercase?
 
Hello guys, i have 2 question 1st: Is it possible to accept both upper and lowercase? For example you have this code string question; cout...
[12 replies] Last: it seems likely mine was using the C version, actually... looking at ... (by jonnin)
February 2019 Pages: 1... 1112131415... 23
  Archived months: [jan2019] [mar2019]

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