Daniel
Could try converting the float to a string
but this is float in the target process, this does not mind?
Daniel
can i show the code wich i am trying make the change to my issue?
Daniel
oh boy, forget it man, this works. Thanks a lot my friend!!!!
Avinash
Anyone having complete C# course?
klimi
Why you want people to message you privately? if you want to contribute something to the community, you can just do it, if it is related. Be aware that sharing unwanted/low quality information may be considered as spam or low quality promotion.
klimi
why the "pm" part then? why not just drop it here or in the offtopic group?
Babasaheb
totally agree
klimi
well if this isn't that low quality content, I don't know what is
Babasaheb
people can not send link in this group?
klimi
they can, but there is 24h period when new users links are deleted so admin can verify them
klimi
(this is in order to minimalize join spam)
Babasaheb
may be you can send a screenshot
klimi
no, you are allowed to send links if they have meaning, what you have send is low quality advertisement.
Anonymous
Hello, please anyone can help with this assignment.I already try five different method for this but our teacher rejected all *Represent 100 (0 to 99) numbers using switch statement with not more than 20 cases. For example when I type 43 and press enter I should see 'forty three' on screen."* Only one switch and no if else case
xe
How to set the number of digit to input in c++?
Null
Hy i want to know something How to make a floating menu only using c/c++ When we exicute c/c++ compiled file in Android terminal so that floating menu/window appear on screen
coal
you cant communicate with the android api directly from c++, you'd need JNI or a pure Java server
coal
also with "android terminal" do you mean adb? or what is it exactly
coal
if you mean termux, you're even farther, termux doesnt allow you to talk to the android api, not without the plugin they sell which serves for this purpose
coal
if i was you, I'd do a java server and communicate with it through adb
coal
sorta like what scrcpy does
coal
No its not true
oh really, then that's unfortunate, poor java people invented JNI for nothing
Nova
Can you guys tell me about any intermediate guided c++ projects I just wanna make it for my final year
Kartik
In for each loop, is there any alternative to use instead of "auto" keyword, when working with hashmaps? for( auto i : res ){ //code here }
\Device\NUL
How to set the number of digit to input in c++?
I don't understand what you mean. iomanip ?
notyour
Guys how do I go to the first message in this group?
notyour
Got to the first message!
notyour
Just wanted to see who were the first members!!
klimi
uh, ok c:
itsmanjeet
Hey all, need some help with regex again
itsmanjeet
(\/\/\/(.*)[\n])+(\w+ := (.+)) here is the regex pattern which i create, it will detech the /// comment <new-line> <word> := <anything> <end> and tested it on https://regexr.com and working as expected, and here is the c++ version for it \\/\\/\\/(.*)[\\n](\\w+ := (.*)) and using it with regex_search
itsmanjeet
here the shareable link for it regexr.com/6gei5
itsmanjeet
its working on the site but not with the c++ regex_search(input, smatches, regex);
itsmanjeet
#include <bits/stdc++.h> using namespace std; string input = R"( /// I am a comment x := 5 /// Another comment y := 10 )"; int main(int argc, char** argv) { regex r("\\/\\/\\/(.*)[\\n](\\w+ := (.*))"); smatch matches; if (regex_search(input, matches, r)) { for (auto i = 0; i < matches.size(); i++) { cout << matches[i].str() << ", "; } } return 0; }
itsmanjeet
these is the exact copy of implementation
itsmanjeet
I noticed that i added regex::extended
itsmanjeet
with that its giving no matches, and without that its only providing the first one
AmR
I need help with cmake project, any one can help me ?
Kartik
Just use hashmap's template data type?
Yes. Unordered map is what i'm using.
Anonymous
#include <bits/stdc++.h> using namespace std; string input = R"( /// I am a comment x := 5 /// Another comment y := 10 )"; int main(int argc, char** argv) { regex r("\\/\\/\\/(.*)[\\n](\\w+ := (.*))"); smatch matches; if (regex_search(input, matches, r)) { for (auto i = 0; i < matches.size(); i++) { cout << matches[i].str() << ", "; } } return 0; }
You need to run regex_search again and again until the string is exhausted apparently. I copied this from a c++ reference website : while (regex_search(input, matches, r)) { for (auto x : matches) cout << x << ", "; cout << endl; input = matches.suffix().str(); }
Anonymous
Yes. Unordered map is what i'm using.
Yeah, so use pair with whatever datatypes you've used in the map as template arguments. Like pair<int, int>
itsmanjeet
one more help, This first part (\/\/\/(.*)[\n])+ holds the last comment only in group1
coal
In for each loop, is there any alternative to use instead of "auto" keyword, when working with hashmaps? for( auto i : res ){ //code here }
auto only means "infer the type of the value" if you're doing a range-based loop over a vector of strings, you can just do for (std::string& str : mystrvec) {}
Anonymous
What do you mean? ...
Kartik
Yeah, so use pair with whatever datatypes you've used in the map as template arguments. Like pair<int, int>
Makes sense, but whats the syntax when writing like the way i did. I dont think (<int, int> i : res) is right. Is it even allowed to write like this?
Kartik
pair keyword is required👍
Anonymous
pair keyword is required👍
It's a template class, not a keyword. Learn a bit about templates before using STL
coal
(pair<int, int> i : res)
don't ignore std namespace when suggesting code as that promotes bad practices
coal
pair keyword is required👍
#include <utilities> #include <map> #include <iostream> int main() { std::map<int, int> mymap { {1, 2}, {3, 4} }; for (std::pair<int, int> mpair : mymap) { std::cout << "key: " << mpair.first << "val: " << mpair.second << std::endl; } }
Artur
You should be able also to write it the following way: for (const auto [x,y] : myMap ) { // ... } If using c++ 17+
coal
ah yes c++17
https://en.cppreference.com/w/cpp/language/structured_binding
coal
that's an useful insight as well, ty
Anonymous
Is there any good aes encryption library, I have found a few but they are not easy to use
Kevin
Problem 2 - Seat exchange (seats) Here at Reply, we encourage knowledge sharing. We also want Replyers to get to know each other, so we organise various social events throughout the year. One of these events is the Reply Desk Meeting, where Replyers can get to know new people just by sitting at their desk. At the beginning of the event, N different Replyers are sitting in N different seats, both numbered from 0 to N − 1. After each day, all Replyers move to a new location. In particular, a Replyer sitting in a seat i will move to the seat P[i] the next day. In this way, as the days go by, each Replyer will always have different neighbours to get to know. Given the number of days K, write a program to find the final seat configurations. Input data The first line of the input file contains an integer T, the number of test cases to solve, followed by T testcases, numbered from 1 to T. In each test case, the first line contains the two integers N and K: the number of seats and the number of days. The second line containts N space-separated integers, the array P[N] with the exchanges configuration. Output data The output file must contains t lines. For each test case in the input file, the output file must contains a line with the words: Case #t: v[0] v[1] . . . v[N − 1] where t is the test case number (from 1 to T) followed by N space separated integers: the seats con figuartion after K days. Constraints • 1 ≤ T ≤ 20. • 1 ≤ N ≤ 100 000. • 1 ≤ K ≤ 100 000. • At day 0 each Replyer i is seated in his original place i. • The array P[N] is a permutation of 0, 1, . . . , N − 1. Explanation In the first example, after each day we will have the following seats exchanges: • The Replyer sitting in seat 0 remains there. • The Replyer sitting in seat 1 moves to seat 4. • The Replyer sitting in seat 2 moves to seat 3. • The Replyer sitting in seat 3 moves to seat 1. • The Replyer sitting in seat 4 moves to seat 2. The exchanges during the 2 days we be: • Replyer 0 seated in 0 → seated in 0 → seated in 0 • Replyer 1 seated in 1 → seated in 4 → seated in 2 • Replyer 3 seated in 3 → seated in 1 → seated in 4 • Replyer 4 seated in 4 → seated in 2 → seated in 3 • Replyer 2 seated in 2 → seated in 3 → seated in 1 The final configuration of the seats is therefore 0 2 1 4 3.
Kevin
I solved it like this: https://justpaste.it/90476
Kevin
but it's too slow
coal
but it's too slow
it's slow because << writes and flushes the file every single time
Babasaheb
now i study Qt,do we have a qt group