Beginners - May 2019 (Page 10)

Recursion
 
I need to write a function that will swap two elements in an array of chars. This needs to be done recursively. I can swap the elements by creating a temporary ...
[15 replies] Last: Thanks again! (by stoneJax)
string sorting
 
Write your question here. How are strings sorted? They are compared with ascii but sometimes the total ascii value can be the same but rearranged differ...
[1 reply] : Strings are compared lexicographically. [quote=cppreference]Lexicograp... (by mbozzi)
Library inclusion issues
 
I think my program is generating errors due to my library inclusion, can not figure out why. Here's the header file with the libraries: #pragma once #inclu...
[1 reply] : What do you mean by the header file? Do you include that file in eve... (by dutch)
Error on Sokoban code
 
Hey guys, I'm developing a similar Sokoban code, for a beginner programmer. But, some error is occuring when the "gamer" put the object in front of the wal...
[1 reply] : What exactly do you think this is testing? if (x != 8 and cx != (x ... (by dutch)
what is the pattern to be followed
 
https://www.codechef.com/MAY19B/problems/ADAROKS2 I tried backtracking but its too complicated and difficult to check for rectangles ....Please tell the appro...
[2 replies] Last: > Please tell the approach How many chess boards have you drawn on pa... (by salem c)
I think I have declared and implemented these booleans wrong
 
Simply, what are the flaws here? I was never good with bool, so I have no idea. The following code is extracted. This code is from the header file bool ...
[13 replies] Last: I don't, and that is why I didn't mention it earlier. My last post was... (by Peter87)
by ICantC
basic string class
 
I'm trying to implement a basic string class for educational purposes (I'm told the std::string is mainly complicated template code), I've made a start below bu...
[5 replies] Last: [quote=ICantC]Yeah I'm still going to use std::string for everything, ... (by George P)
DevC++ graphics.h
 
I have downloaded the graphics.h files and placed them in the right directories, and linked to -lbgi. The DevC++ compiler is giving errors such as the following...
[3 replies] Last: [quote=salem c]Borland Graphical Interface belongs in a museum, and yo... (by George P)
by mpg
Power recursion
 
Is it right? #include <cstdlib> #include <ctime> #include <cmath> #include <iostream> using namespace std; int potenza(int x, int y) { if (x == 0 && y==0) ...
[8 replies] Last: true, you have to add if both are zero check. good catch, but you can... (by jonnin)
by Pecvx
const member functions
 
Hello, Let's say we have a class defined like this: class myClass { private: int a; public: myClass(int a) : a{a} {} int geta() const { ...
[5 replies] Last: For class types and references there is a difference: struct Bar { ... (by keskiverto)
by Ivitoh
Jump to a specific string of a list<string> (1,2)
 
Hello, just like the title says, i want to jump to a specific string from a line<string> that has a lot of strings that were passed by a text, for example, lets...
[20 replies] Last: Okay... What I have done so far.. bool AYED2019::operaciones(vector<s... (by Ivitoh)
Can you help me with this exercise thank you
 
Hello, I was trying to comprehend this exercise and I can't seem to understand what the exercise is asking, it took me along time to realise 62.14 is also 0.261...
[4 replies] Last: I never really understood gallon conversation Bean counter disappr... (by MikeStgt)
Returning an array of type struct
 
I have a struct that takes in values for name, id, salary, etc, called Emp. I have a function that creates an array, employee , and then uses a for loop to fill...
[4 replies] Last: Thanks Repeater, the same code is very helpful (by crimsonknight166)
solve congruency
 
Write a procedure to solve a pair of congruences of the form x ≡ a (mod m) x ≡ b (mod n) where m and n are relatively prime. The existence and uniqueness ...
[6 replies] Last: thank you so much, I understand it now (by hnkwana)
Exceptional handling simple program
 
Write a simple program using function that throws an exception if divide by zero occur and catch the exception in main. b. Write a program to throw and catch th...
[8 replies] Last: Thanks a lot Enoizat! (by lost110)
Approach for the question
 
https://www.codechef.com/MAY19B/problems/WTBTR I just can't understand how to start the approach.Please help.I know it's a live contest so don't give direc...
[6 replies] Last: I have got partial marks. What is the logic of getting All AC ? please... (by lucifer21)
breaking code into functions
 
as an exercise I have to write a program with specific functions. Find primes then put them into a vector then print them out. The last 2 I think I can do its ...
[3 replies] Last: #include <iostream> #include <vector> #include <iomanip> // functio... (by JLBorges)
lottery program with function
 
I have written a program for the prompt, "You’re going to write a program that models the Littleton City Lotto (not a real Lotto game). The program is goi...
[2 replies] Last: I see that now, removing the brackets doesnt work either and i am not ... (by mercedx)
by Fortem
Database in c++
 
Hi guys. So I am about to create a program that can manipulate a database outside of the program, but I got tons of ways to do that and I'm puzzled which method...
[3 replies] Last: Second on Duthomhas. MySQL has been a staple for a long, long while, ... (by Niccolo)
by AxA
what is the difference between these 2 types of initializing an integer?
 
what is the different between: #include <iostream> using namespace std; int main() { int x{1}; return 0; } and #i...
[3 replies] Last: In such a short example you cannot spot any difference, but the unifor... (by Enoizat)
May 2019 Pages: 1... 89101112... 16
  Archived months: [apr2019] [jun2019]

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