Beginners - November 2017 (Page 10)

Reading data from text file into a dynamic array of structs
 
Hello, I am having some trouble reading my data into a dynamic array of structs. Below is my code as well as a copy of the text file. While debugging, I see tha...
[1 reply] : It's not a good idea to use eof() as the loop condition. It can caus... (by Chervil)
How to fix this "Call of overloaded function is ambiguous" error?
 
I have the following simple code: template<class T> class myClass{ void print(string s){ //something } void print(T t){ //something els...
[3 replies] Last: #include <string> #include <iostream> struct some_class { // ov... (by JLBorges)
Why doesn't my assignment operator overload work properly?
 
I am trying to create a String class like so: class String{public: string s; String& operator=(String a){ s = a.s; return *this;} String& operator=(st...
[3 replies] Last: @JayBari thanks, I didn't know copy constructors function like that. I... (by daverave1212)
What am I doing wrong!!
 
This is the problem A car dealership has 10 salespeople. The dealership keeps track of the number of cars sold by each salesperson each month and reports it t...
[1 reply] : try for (int i=0; i<10; i++) (by SamuelAdams)
by Hahang
Everyone help me fix this! I can not fix it! thank you so much
 
Write your question here. #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<string.h> #include<stdlib.h> #include<windows.h> #include<math.h> //...
[1 reply] : See where you wrote, "Write your question here." Please do so. What pr... (by joe864864)
Undeclared Variable In a Class?
 
Hey! I'm trying to use the get/set functions in a class to return a hidden variable, but keep getting the use of undeclared identifier in the getMinutes and get...
[1 reply] : Your get functions return "minutes" and "seconds" but your variables a... (by joe864864)
Adding classes for weapon and armor in adventure game
 
I am asked to Make a hero class and add specific inventory slots for a weapon, armor, and ring. So far I have created the classes below but I am not sure how to...
[no replies]
string manipulation
 
Hello, I am trying to manipulate a string (below). How would I put "John" in a seperate string, 1 in an int, 2 in an int, and 3 in a double? I figured out how t...
[1 reply] : std::istringstream input(s); //#include <sstream> std::string name; i... (by ne555)
how to use std operators
 
Hello! As the title says how do I use std operators? I don't know if I'm doing something wrong or anything. But All i did is go by logic since std is a names...
[1 reply] : Never mind my mistake was not in this but in somewhere else and not in... (by stonedviper)
by agill
Beginner help with loop validation
 
I'm trying to create a program that asks a set of questions to determine what kind of tree a person is looking at. I'm new to programming and I'm having a hard...
[5 replies] Last: Oh wow, that's such a good idea. Thanks Joe! Now I've got a lot to wor... (by agill)
May be a tough one
 
I have a code that acts as a login system. You can log into a computer, logout, search for users that are logged in, and then quit the program. The computer la...
[2 replies] Last: Welp that solves it. (by donda97)
Noob need help again!
 
hello respected members,l am learning c++ on my own and if anyone of you have known any best website,youtube channel or any book for learning cpp then please le...
[2 replies] Last: I started with Michael Dawson's Beginning C++ Programming. It is a ni... (by JayBari)
Noob need help again!
 
can somebody please eloborate me this code please? thank you so much in advance. #include<iostream> #include<conio.h> //using namespace std; // <---...
[1 reply] : I am not sure specifically what you are asking, but I see in your prev... (by JayBari)
Help with nonstandard syntax
 
I keep on getting the error non-stand syntax; use '&' to create a pointer to member for the if (itemName == itemsToPurchase.at[&i]) and allItemsCount.at[&index]...
[10 replies] Last: this is probably redundant as many others have pointed this out but th... (by adam2016)
Load dll from folder inside .exe
 
Goodday, i have run into a small problem. i have a simple program and dll file. Both are working perfectly. But when i try to load the dll when it is in a fo...
[5 replies] Last: @thomas1965 @coder777 Thank you! It works now! The problem was that th... (by krreisys)
assert a pair of integers in a std::array
 
How can I assert if two integers are valid given the following declarations: enum entry {empty, nought, cross}; class board { public: board(); // R...
[2 replies] Last: What would be the most efficient method be for asserting if two inte... (by gunnerfunner)
switch statement compile time error
 
I'm trying to make a calculator that follows precedence rules,I'm following Bjarnes book anyway I get an error that I have never encountered before the error is...
[3 replies] Last: that makes sense thanks =) (by adam2016)
program crashes reversing a string
 
not too sure why my program crashes here is the block of code causing the crash string first; cin >> first; cout << first.size(); string reverse; ...
[6 replies] Last: very true sometimes there is no need to reinvent the wheel (by adam2016)
Problem with array program
 
I wrote this program for the college. The user must input 2 numbers (n,m) and the program must make an array with the size [n,m]. Then the user will fill the ar...
[2 replies] Last: Thank you so much for your response. I will try what you said and i wi... (by lollos97boom)
by Bopaki
The second parameter in the class definition is an Array
 
I am not sure how to write in in my main() I get this error: C:\Martin\MalikChapter1\bookType23032016.cpp:166: error: expected primary-expression before '['...
[4 replies] Last: The std::initializer_list and its corresponding header #include <in... (by Chervil)
November 2017 Pages: 1... 89101112... 33
  Archived months: [oct2017] [dec2017]

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