General C++ Programming - November 2018 (Page 11)

by DellXT
Help needed. Converter
 
Hello. I need to create converter from CP437 encoding to UTF-8. Firstly, program reads file in one byte at a time. Then if its meaning is >=128 changes symbol i...
[1 reply] : wchar_t convert(int d) { wchar_t c = static_cast<wchar_t>(d); ret... (by Repeater)
Help me in optimizin this code
 
#include <iostream> using namespace std; int main() { int t; cin>>t; while(t--){ int flag=0; int n; cin>>n; int a ; for(int i=1;i<=n;i++){ cin>>a ;...
[1 reply] : Duplicate thread; http://www.cplusplus.com/forum/beginner/245384/ (by Repeater)
by Satan
Is it possible to flush input stream without '\n'?
 
I have been searching for like the past half an hour.. am I just being stupid? But I really couldn't find anything to flush the input buffer when the buffer doe...
[2 replies] Last: fflush(stdin) is undefined behaviour. https://faq.cprogramming.com/cgi... (by Thomas1965)
funcction
 
Write a function to with an input file and output file as arguments to edit the input file and replace every string of two or more consecutive blanks with a sin...
[8 replies] Last: Sorry I misunderstood. (by Thomas1965)
by jbap
convert back from days to date (C++)?
 
I have a C++ code that turns the date back to day (considering leap years). I get a date from the user and turn it to day (my base is 1900/01/01). I thought tha...
[2 replies] Last: the problem is you so truly put it is I do change that number; the num... (by jbap)
Vector of strings to bitset
 
vector<string> alphabet; alphabet.push_back("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); vector<bitset<7>> bset(alphabet.size()); for (int c = 0; c < alpha...
[1 reply] : A vector of strings that you push one string into has a size of 1. I t... (by tpb)
Need help with dynamic array of objects with user defined functions.
 
Suppose how had a text file that looks like this, Lemon 1 Apple 2 Orange 3 How would you create a user defined function to generate a dynamic array of objec...
[14 replies] Last: [quote=Repeater]Was assembly used when the concept being taught was "h... (by closed account 1vRz3TCk)
sales receipt help
 
#include <iostream> #include <iomanip> using namespace std; int numb; int word=1+0; int cost; int main() { char item ; cout<<"Welcome to the new new an...
[1 reply] : Please use coding tags (http://www.cplusplus.com/articles/jEywvCM9/), ... (by Satan)
I need to use a loop to calculate average rather than the Array.Average() method
 
I need to use a loop to calculate average rather than the Array.Average() method and I'm very new with c++ so I don't have a lot of understanding for it (my pro...
[3 replies] Last: The code doesn't even compile. The name 'iceCounter' does not exist i... (by Thomas1965)
I need help
 
------Input Enter in the number of sales items Enter in the name of the sales item Enter in the price of the sales item ------Output Title for the ou...
[1 reply] : Welcome. If you have a specific question, we'd love to help, but we ar... (by Ganado)
Need help on loops
 
Please help me on having the following requirements If the user uses an incorrect format, an error message prints. The user is asked to retype in their pass...
[4 replies] Last: > Also, for the changeColor it is a function that my teacher provided ... (by ne555)
Simple C++ 2D game engine with Drag and drop
 
Anybody know a simple yet popular 2D C++ game engine with a drag-and-drop feature? I'd use Cocos Creator but I don't do Java-Script.
[1 reply] : Perhaps this? -> https://godotengine.org/ (by toad)
The output is not right
 
Hello, I am working on a small program for the school. I have done everything, but the output is not as expected to be. the program is reading data from a text...
[4 replies] Last: int main(){ const int n = 15; std::string name ; double hourly_wag... (by ne555)
assigning values from text files.
 
Hello, I need to have a project where the console looks like this. (https://gyazo.com/5bce349994b0d7f72cdb706092e8fdb3) I currently have this code. #inclu...
[2 replies] Last: Oh my. Thanks a lot for all of this. I will give this a try tonight. I... (by noshkren)
Comparing values from array
 
Hello everyone, Let's say I have an array with these values: int foo = { 1, 2, 3, 4, 5 }; I would like to compare the values inside the array by randoml...
[4 replies] Last: You did miss the point of the shuffle: int v { 1, 2, 3, 4, 5 }; ... (by keskiverto)
Octal to binary conversion using functions
 
Can any one please explain the working of loop while converting octal to binary number
[1 reply] : All numbers are numbers for the computer. "octal" and "binary" are sim... (by keskiverto)
Random Numbers, if statements, loop
 
I am programming monopoly, and I have this program. I have two players, both start from "GO" which is equal to position 1, then I created a RNG that works as t...
[1 reply] : After newPosition = POSITION(storeValues , totalDice, positionArray);... (by Thomas1965)
need help if else
 
hi guys i am trying to program this 1. Write a program to compute the pension of an employee If the person is male Age >= 90 pension is 4000 ...
[8 replies] Last: THANKS TO ALL (by even better)
“extensible singleton” using template function create instance Instance with singleton pattern in C++ ? How is it done?
 
I am totally stuck on how to make this work and i just want a straight explanation that i don't need to decrypt. I gotta make an abstract class following single...
[2 replies] Last: While I agree we shouldn't strive for them, having just a few singleto... (by Ganado)
by lolol
How do I store different numbers into a array and than compare them later on. The variable I'm trying to store is y.
 
#include <iostream> #include <cmath> #include <vector> using namespace std; double income (double a, double b, double I) { double i; i = I...
[1 reply] : int t; double great ; variables cant be used for array sizes in standa... (by jonnin)
November 2018 Pages: 1... 9101112
  Archived months: [oct2018] [dec2018]

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