General C++ Programming - January 2017 (Page 8)

overloading operator<< - help needed
 
For my PPP2 book, I need to implement a Date class which has an enum class Month for the months. I can't output the months that easily with operator<<, as the ...
[5 replies] Last: Yeah, never mind on that. I'm doing a drill right now that says to us... (by DragonOsman)
by Troaat
Inherit From 2 Common Inherits
 
Hi everyone, I was wondering if I could inherit 2 classes for a third one (the first 2 classes are inherited from a mutual one). I tried compiling such a thin...
[7 replies] Last: [quote=gunnerfunner]So it makes more sense for class sector to contain... (by TheIdeasMan)
by naham
simple guessing game
 
i are required to write a code for simple guessing game. In this game my code will choose a random number, between 1 and 100 as secret number. Then it will as...
[2 replies] Last: i need code of this game (by naham)
by Obaro1
assist
 
pls i have a challenge, i have just been given a project topic which is to write window app that can estimate the energy consumption of household appliances. b...
[1 reply] : Can you write a console app to do the same thing ? if not can you do i... (by SamuelAdams)
Need help with Class code.
 
I am writing a code that converts a non-negative number into a vector of binary numbers. Example: 19 should become 10011 that is stored in a vector<bool>. I am ...
[2 replies] Last: or use bitset operators (by shadder)
Identifying mathematical sets from input.
 
A set is a sequence of comma separated elements enclosed in square brackets. An element for a set can be an alpha-numeral or another set. Furthermore, the eleme...
[3 replies] Last: OP: you could also have a struct Element for each element of the set w... (by gunnerfunner)
by nbro
When should value semantics be preferred over using smart pointers?
 
Hi! I've seen people saying to prefer values (value semantics) over X, where X once happened to be "smart pointers". I understand the main benefit of using sm...
[2 replies] Last: Even with smart pointers, it's a mistake to just assume smart-pointers... (by mbozzi)
Separate a string in two parts
 
Enter Your Name along with Roll No Roll No NAME For example Mc1504029 Kuhshdil Kamal fall 2016 BS40383 Nadeem spring 2017 Output Roll No ...
[6 replies] Last: OK thanks for help (by kamal3310)
Palindrome Problem
 
So basically this is a palindrome checker for strings. The problem is that I have to make it run 3 times, so a for loop, but then the "Not a palindrome" goes in...
[4 replies] Last: You got it Thanks (by wawaluigi1234)
Undirected weighted graph matrix
 
I do not really need help with programming, i more like need some test data which i can't seem to find. I just finished my homework, which was finding the minim...
[no replies]
Operator Overloading !!
 
I need to know can i change cout operator ""<<"" with "<"(single one) with operator overloading or anyting else ?
[1 reply] : Yes you can. #include <iostream> // Use templates to redirect ... (by Peter87)
by kais2
to find a word in a string
 
#include<iostream> #include <stdio.h> #include <iomanip> #include<string> using namespace std; int main() { string s; getline(cin,s); cout<<s<<endl; ...
[2 replies] Last: thanks :) now it's giving me the third word (by kais2)
Exponents and Square Roots
 
This is my question. I'm writing a program for an assignment that asks me "Determine the position of the dot M (x, y) relatively to the circle O (xo, yo, r)." ...
[1 reply] : Firstly, you may need to clarify things a bit. The distance of M from... (by lastchance)
by Cnoob8
undefined reference to
 
Hi guys! i wrote one c++ program to recreat and play one game but i have this 'undefined reference to ' on 3 of mine functions... Someone knows how to solve ...
[1 reply] : Could you provide the code snippet? You can't exactly pinpoint what's ... (by Golden Lizard)
Finding a specific weekday
 
I was given the assignment of finding the specific weekday of a date while using January 1st as a reference point. This is what I have done but I'm kind of stuc...
[5 replies] Last: edge6768 has the right idea. Need to accumulate leaps years but the ... (by closed account 48T7M4Gy)
Is this correct / Suggestions?
 
Hello, I have tried to make my start of a Component Manager for all bunch of Components I want in my project. I have almost never used Polymorphism so I want yo...
[5 replies] Last: virtual ~Component() = 0 {}; //ยง10.4/2 a function declaration cann... (by gunnerfunner)
Pulling pieces from a string
 
So I take a biology class, and in my class we are working on sequencing DNA and mRNA. I was wondering how I could make a program that reads each character in my...
[1 reply] : If the sequences are in a file read that file character by character. ... (by edge6768)
Passing Structures to Arrays
 
So I know that there are topics about this already, but I have seen none that help with my specific problem. #include "stdafx.h" #include <iostream> #incl...
[8 replies] Last: With your while do while switch, it's easier to put the switch in a lo... (by TheIdeasMan)
C++ File handling help needed
 
The following program is actually written to count the number of alphabet in a .txt file. But the problem is that it gives different outputs every time. What am...
[7 replies] Last: You might also try Coliru (This is @gunnerfunner's solution) :) http:/... (by mbozzi)
How to use namespace in different files
 
// 1.cpp //------------------- #include<iostream> namespace np { int i = 0; } //------------------- // 2.cpp //--------------------------------------...
[8 replies] Last: @doug4 The ability to inline variables was (will be) added in C++17: h... (by mbozzi)
January 2017 Pages: 1... 678910... 13
  Archived months: [dec2016] [feb2017]

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