Yigrem
/get
Aida Ataee
I would be thankful if you introduce a good website for learning C
Anonymous
I would be thankful if you introduce a good website for learning C
Lets make this the best website coz you are here
Manav
/get
Kartik
/get
Abdurahmane
Hello ! I'm new in Qt. When I try to load an image i get this error message : QML Image: Cannot open: qrc:/imageTest.png imageTest.png and the qml file are in the same directory. import QtQuick 2.9 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 480 title: qsTr("Test") Image { id: image1 x: 10 y: 10 width: 100 height: 100 source: "imageTest.png" } }
Abdurahmane
I'm using Ubuntu
Abdurahmane
Maybe it needs to be in the root folder of the project or near the executable (depending on when the error happens)
Thanks for your answer. I solved the issue by setting the path in the qrc file <file>imageTest.png</file>
Abdurahmane
Now I'm wondering if I need to always define the paths of my resources manually in the qrc file or is there any way it can be done automatically.
Abdurahmane
Waouh just discovered that I can click on the qrc file and then use the add button to select all the files I want to add as resources. It's very easy ! No need to go a write xml in the qrc file.
Abdurahmane
It's ok for me.
Diypa
Hi
Diypa
#include <iostream> using namespace std; int main() { int player; int s_hour; int e_hour; int SmallestNumber; int winner; cout << endl <<" ********** " << " \n Player nr "; cin >> player; cout << " Start hour: "; cin >> s_hour; cout << " End hour: "; cin >> e_hour; while (player > 0) { cout << endl <<" ********** " << " \n Player nr "; cin >> player; if( player < 0) { // terminate the loop break; } cout << " Start hour: "; cin >> s_hour; cout << " End hour: "; cin >> e_hour; if (s_hour < SmallestNumber ) { SmallestNumber = s_hour; } } cout << "Smallest number is: " << SmallestNumber << '\n' << endl; cout << " And the Winner is : " << player << '\n' << endl; return 0; }
Diypa
I have written this... but I have problem with get the winner number wich is player nr..
Diypa
Anyone knows what do it... recommendations please
Diypa
Hi Pavel. I use -1 to terminate the loop. The smallest start hour will make the player a winner. I get the smallest number it works. But I cant get the player number.
Diypa
/ cant get this to work, // cout << " And the Winner is : " << player << '\n' << endl;
Diypa
I do appricate any help.
Pavel
Hi Pavel. I use -1 to terminate the loop. The smallest start hour will make the player a winner. I get the smallest number it works. But I cant get the player number.
You can increment player number on each iteration, then when it equal to player count reset it to zero. // before the loop int currentPlayer = 0; // first player //inside the loop ++currentPlayer; if (currentPlayer >= playersCount) { currentPlayer = 0; } Something like this
Diypa
🌹🌹🌹 Thank you.. it is clear now to me
Diypa
Thank you very much
محمد
🌹🌹
🍥N00d1e5🍜
Hi guys, do you have any idea why fscanf return null please?
🍥N00d1e5🍜
I run the same code on an ubuntu and an opensuse, it works on OpenSuse, but not on Ubuntu...
🍥N00d1e5🍜
This is the code's repo: https://github.com/dple/ecdsa/tree/a64c3b610591be34b6a6688c9b5004b60803efbe
🍥N00d1e5🍜
In the second step, it should read the priv256.pem, and get the first line with fscanf function. But it returns null on my Ubuntu, but correct value on OpenSuse...
🍥N00d1e5🍜
Read the docs please
I am on that. But I have no idea why it works on one Linux, but not on another...
🍥N00d1e5🍜
I don't know if I should install or replace any local library
🍥N00d1e5🍜
The code correctly initialise the value in the file ecdsa.c - line 605 by char curve[9]; and just one line below, fscanf(file, "%s", curve) I cannot find any error Besides, it works on another linux (OpenSuse)
z
Hi guys, do you have any idea why fscanf return null please?
fscanf doesn't return a pointer, it returns an integer. Can you show exactly what you mean by return null?
z
Here the function signature int fscanf(FILE *stream, const char *format, ...);
🍥N00d1e5🍜
fscanf doesn't return a pointer, it returns an integer. Can you show exactly what you mean by return null?
Thanks for ur reply :) According to the manuel of the repo, when I run the second step: /ecdsa --genkey --name secp256r1 --out priv256.pem It should get the type of the curve, but it returns error message: Curve (null) was not built-in the program
🍥N00d1e5🍜
which is line 326 and then line 329
🍥N00d1e5🍜
emmm sorry, it seems not the problem of fscanf, but some points else. Working on it
数学の恋人
Guys is it good to use constructors with constexpr? I mean to say something like this, class someClass { private: int a; public: inline constexpr someClass() : a(5) {} };
数学の恋人
I don't think so it's needed and might come under bad practices too
Alejandro
Note that constexpr means that it can be used in constexpr and not in constexpr situations. It doesn’t disallow normal usage
Alejandro
It doesn’t mean that you should go crazy and add constexpr everywhere but if you suspect it may be used, better to do it. Lots of std containers in the recent versions of C++ have been made constexpr :)
数学の恋人
but when I want to do something like, class someClass { private: int a; public: inline constexpr someClass() : a(5) { std::cout << "Initializing a\n"; } }; Compiler gives me warning, that is -Winvalid-constexpr
数学の恋人
but if I remove cout statement it is fine
Adam
//ge
数学の恋人
I think I'm using constexpr in wrong way
数学の恋人
constexpr will be used to generate constexpr and I'm giving it a freaking print statement in between that's why it's going wrong, nvm I understood what I'm doing wrong
Alejandro
constexpr will be used to generate constexpr and I'm giving it a freaking print statement in between that's why it's going wrong, nvm I understood what I'm doing wrong
yes, you have to be careful. Inside the constexpr functions (including constructors) you can't use anything that is not constexpr
Alejandro
since cout is not constexpr, then that doesn't work
数学の恋人
Yeah I got it, thanks for helping me out
🍥N00d1e5🍜
fscanf doesn't return a pointer, it returns an integer. Can you show exactly what you mean by return null?
I find the "reason", the string ”secp256r1“ is 9 caracters, but it needs 10 for '\0'. However, now I don‘t understand why it works on OpenSuse...
🍥N00d1e5🍜
line 326 in ecdsa.c
z
I find the "reason", the string ”secp256r1“ is 9 caracters, but it needs 10 for '\0'. However, now I don‘t understand why it works on OpenSuse...
It is undefined behavior. If you access index beyond the array capacity, the value is undefined. It can be anything, unpredictable. It is just lucky that the value you got on OpenSuse is a NUL char \0. So it worked. The value can be anything in your memory, the order of local variables on the stack is totally up to the compiler. So you basically just invoked undefined behavior.
z
I find the "reason", the string ”secp256r1“ is 9 caracters, but it needs 10 for '\0'. However, now I don‘t understand why it works on OpenSuse...
You can catch this issue on runtime by using address sanitizer. When you compile, use -fsanitize=address and use -lubsan when you link the ELF.
🍥N00d1e5🍜
I will try that, I just saved your message in my notes. Really appraciate that.
Sachin
#include <stdio.h> #include<string.h> int main() { int max=0; char a[100]; scanf("%[^\n]s",a); //fgets(a,99,stdin); int l = 0,s = 0; for(int k=0; a[k]!='\0' ; k++) { if(a[k] != ' ' ) l++; else { if(l>max) {s=k-l;} max = max > l ? max : l ; l=0; } } printf(" %s ",a[s]); }
Sachin
anyone
Sachin
?
Kartik
Remove
Sachin
then how should i input string
Kartik
Sorry my bad
Kartik
Yes
Kartik
Remove %s and write only s As string is derived data type
Rahul
Anyone can tell. This WhatsApp group is also useful for anyone. Whether or not the message keeps running in vain. I have joined this group but I don't know anything. How to use it?
HaiNahi
/warns
I want internship, I kept 1$ to filter uninterested
klimi
I want internship, I kept 1$ to filter uninterested
no need to tag me for that, i am not interested
HaiNahi
I want free job I am in diploma college :)
HaiNahi
Yes
klimi
ok, great
klimi
but what do i have to do with that? quite.... nothing