Anonymous
Anyone expert in c++
Anonymous
Georges
Hello How can i implement a CUDA version of exclusive scan.
Hanz
Anyone expert in c++
dontasktoask.com
Hanz
lol why he PMing me while this group exist
Anonymous
Anonymous
Anonymous
Explain how one can determine if two prime numbers are twin prime. Twin primes are consecutive prime numbers, for example 1 and 2, 2 and 3, 3 and 5, 5 and 7, 7 and 11, etc Any help on this
1 is not a prime number. 7 and 11 are not twin primes. They are just consecutive primes. I guess you want to find out if two given numbers are consecutive primes i.e. without any primes in between.
Hanz
that is weird
Hanz
he is trying to report himself
Anonymous
Hello guys
Anonymous
Do you help each other in c++ oop?
Anonymous
Given a String with numbers and operators. Perform the operation on the numbers in their respective order. Operator precedence need not be considered. The input string will have the numbers followed by the operators. Input: "12345 * + - + " Result: 6 [Explanation: 1 * 2 + 3 - 4 + 5 = 6] Input: "374291 - - * + -" Result: -8 [Explanation: 3 - 7 - 4 * 2 + 9 - 1 = -8] Guys can you help
Hanz
Rose welcoming Death, uh oh
Anonymous
😅
Pavel
Given a String with numbers and operators. Perform the operation on the numbers in their respective order. Operator precedence need not be considered. The input string will have the numbers followed by the operators. Input: "12345 * + - + " Result: 6 [Explanation: 1 * 2 + 3 - 4 + 5 = 6] Input: "374291 - - * + -" Result: -8 [Explanation: 3 - 7 - 4 * 2 + 9 - 1 = -8] Guys can you help
You can first read all data into array of integers. Create a variable with the result, write the first element from you array there. Then when reading operators if-else-if on each and perform the desired action (with the stored result value and an integer on the given position + 1) and store the result back to the result value. That's the simplest way, but as your operations are all binary you can also make functions for them and create a "factory method" that will return appropriate function for the appropriate operation string.
Anonymous
s = list(input().split()) num = [] e = [] for i in s: if i.isdigit(): num.append(i) else: e.append(i) num = num[::-1] result = 0 final = 0 for i in e: a = int(num.pop()) b = int(num.pop()) if i == '*': final = a * b num.append(final) elif i == '/': final = a / b num.append(final) elif i == '-': final = a - b num.append(final) else: final = a+b num.append(final) print(num[-1])
Anonymous
Yeah 😅
Anonymous
Yeah 😅
You're in the wrong group..
Anonymous
I know but..
Anonymous
I know but..
There are plenty of python groups ,ask there.
Talula
Anonymous
Help me
Talula
Help me
You'll get banned, stop being an idiot, delete the code and PM me if you need help so desperately.
Anonymous
You'll get banned, stop being an idiot, delete the code and PM me if you need help so desperately.
Hi Tazz, its funny but I am desperate for some answers too. Lol. Can I give you a dm of my concern please?
its.ham
Write a C ++ program that contain the following functions Function called Average that returns the average of even numbers in the array Function called Shift that Shift the array right one elementExIf the array is 2,3,8,1,0,6,3, after shifting the array will be 9,2,3,8,1,0,6,3,4,! • Function called Replace that replace elements of the array by entered value Ex. If the array is 1,5,2,8,1,6,1,5,9, and the user enter 1 and 20 then the array will be 20,52,8,20,6,20,594. Function called is Armstrong that take an integer array and Boolean array and fill the boolean array by true or false if the corresponding number is Armstrong or not Hint: Armstrong number is a number that is equal to the sum of cubes of its digits(unspecified number of digits)For example 153 is Armstrong numbers because 1^ * 1^ * 1+5*5*5+3*3*3=153 . if the array is \ 153,12,1259,3\ 0\ , boolean array will be \ 3,0,0,3\ In the main define an array called numbers with size 10 and fill it by the user then call Average and Shift function Enter 2 values and Replace function Define boolean array called Armstrong and call isArmstrong function finally print the array after calling functions and print boolean array
@𝑺𝒐𝒃𝒌𝒂
Hi everybody. I'm trying to write a predicate function that test if a number is perfect. When I call it, main function return a nonzero value and I get nothing at output. What's wrong? #include <iostream> using namespace std; bool isPerfect (int); int main() { cout<<isPerfect(28); return 0; } bool isPerfect (int number) { int sum = 0; for(int i = 0; i < number/2; i++) { if(number%i == 0) sum += i; } return number == sum; }
Ömer Furkan
Anonymous
Hi everybody. I'm trying to write a predicate function that test if a number is perfect. When I call it, main function return a nonzero value and I get nothing at output. What's wrong? #include <iostream> using namespace std; bool isPerfect (int); int main() { cout<<isPerfect(28); return 0; } bool isPerfect (int number) { int sum = 0; for(int i = 0; i < number/2; i++) { if(number%i == 0) sum += i; } return number == sum; }
In isPerfect, you are starting from i=0 and then calculate number%i where i is 0. This is Undefined behavior. Change it. Main function would print 1 in this case as a boolean true value is interpreted as 1 in the cout statement. If you want to see true or false, include <iomanip> and change the statement containing cout to cout << boolalpha << isPerfect(28);
Anonymous
what the output u want to br
@𝑺𝒐𝒃𝒌𝒂
what the output u want to br
The ouput would be 0 or 1. true or false if I use manipulators. But I was deviding a number by 0 at i = 0.
Anonymous
👍
Karan Joshi
Hello I need Google task mate app referral code please anyone have then help me.
'''''''
/getcbook
https://stackoverflow.com/questions/562303/the-definitive-c-book-guide-and-list
omar👷‍♂️
Write a program that reads from the user a string matrix with 3×3 dimensions, the program has to search for a name that is given by the user when the name is found print found else print not found? C++.
omar👷‍♂️
Can some one solve that??
Talula
Can some one solve that??
Yes, someone can... but can you?
Talula
No
Sad... you should be able to do it because it is your assignment.
omar👷‍♂️
Sad... you should be able to do it because it is your assignment.
I stdy program c++ new, I dont have many informations about this program
Talula
I stdy program c++ new, I dont have many informations about this program
Yeah but that is what assignment is suppose to do, they are given to you so that you could learn.
Talula
So I would recommend you start it and when you get stuck we could help you out... this way you'll learn.
Sankalp
Help me please solving program
Sankalp
Create a C++ base class Shape. Derive three different classes Circle, Sphere and Cylinder from shape class. Write a C++ program to calculate area of Circle, Sphere and Cylinder. (Use pure virtual function).
Sankalp
Help me
Ayush Kumar
Create a C++ base class Shape. Derive three different classes Circle, Sphere and Cylinder from shape class. Write a C++ program to calculate area of Circle, Sphere and Cylinder. (Use pure virtual function).
Here's a similar problem, try learning through it and solve it: https://easy-to-code.blogspot.com/2020/06/create-base-class-shape-derive-three.html
Sankalp
Create a C++ base class Media. Derive two different classes from it, class NewsPaper with data members N Name, N Editor, N_Price, No of Pages and class Magazine with data members M Name, M_Editor. M_Price. Write a C++ program to accept and display information of both NewsPaper and Magazine. (Use pure virtual function)
Sankalp
Write a C++ program to create a class Distance with data members meter and centimeter to represent distance. Write a function Larger( ) to return the larger of two distances. (Use this pointer)
Papa
Dont ask homework
Papa
/warn
Sankalp
/warn
Sankalp
anyone here helping solving programs??
Papa
anyone here helping solving programs??
First try yourself, if you have any doubts then ask
Anonymous
20!/11! i.e. (12×13×14×...×19×20)
Anonymous
Well there is something called Catalan numbers in combinatorial mathematics. The formula for number of BSTs with n nodes is 2n!/((n+1)!*n!) and for Binary trees it is 2n!/(n+1!)
Anonymous
https://math.stackexchange.com/questions/1944275/rooted-binary-trees-and-catalan-numbers
Anonymous
Just think of binary trees with 3 nodes...with 1 as a root, there are different trees like 1left2left3 1left2right3 1left2-1right3 1right3left2 1right3right2 1left3left2 1left3right2 1left3-1right2 1right2left3 1right2right3... so 10 in all. With2 as root, 10 more and with 3 as root 10 more. So 30 in all which (2*3)!/(3+1)!
Ehsan
/report
Pim
/get cbook
Pim
/get cppbookguide
Pim
/get ide
artemetra 🇺🇦
/notes
Andrew
/get notename awesomeness