Anonymous
Hello everyone, I'm doing practice and the question arose, how can I repeat the function request several times in Google tests?
What is it that you are trying to do exactly? Are you testing EXPECT_CALLs on a mock object?
Eugene
but char is a distinct type, different from both signed char and unsigned char
Eniafe
Please can someone explain how to print 1 - 100 in C but you can't print double numbey like 11 33 22 and only two combination if you have 12 you use 21 and like if you have 34 no 43
klimi
well, create a for loop for 1 - 100 and skip those which have the same digit?
Eugene
you definitely don’t need error 127, and since the array is up to 100, there is no point in int for two arrays in which you are counting.
Eugene
Нооооо
Eugene
No
Eyvaz
No
char behaves like an integer
Eyvaz
i used it as index
Eugene
No
Eugene
print all char and you will understand that I am right.
Eugene
do you write for pc?
Eniafe
05 ==50?
So I would do it for everything like 05 == 50 && 01 == 10 && 02 == 20
Eugene
Nooooo
Eugene
Yes
For 0...4 for 0..9
Eniafe
What is that cout
Eyvaz
Eniafe
For 0...4 for 0..9
I don't understand please
Eugene
I don't understand please
write two loops one inside the other. inside check if the indexes are uneven you can print the first and second index
Eugene
Yes
Eyvaz
Thank you guys
Aj
#include<bits/stdc++.h> using namespace std; #define ll long long #define fast ios_base::sync_with_stdio(false);cin.tie(NULL); int main(){ int x=log10(100); int n=pow(10,x); cout<<n; }
Aj
why vs code gives wrong output for this program
Aj
the ans is 100 but vs code gives 99 as output
Nils
replace the #define ll long long line with: using ll = long long;
Nils
wait they seem redundant anyways
Nils
So just remove them
Nils
then, check what log10 actually returns
Nils
Add a breakpoint to x
Aj
actually other compilers like codechef, gfg gives 100 but only vs code gives 99
Aj
could you please run in your vs code editor
Nils
log10 is implementation defined
Nils
It's not backed by any C standard from what I know
Nils
On Linux it's in the POSIX standard which Windows doesn't follow
Nils
Since all these online compilers run on Linux and you are on Windows, you get different results
Nils
It's not backed by any C standard from what I know
Correction, it's backed by C99. Means, your compiler straightup isn't standards compliant.
Nils
Aka it's a bad compiler.
Aj
that's why i want to know, Is there any error in my vs code or it's universal
Aj
Vs code editor
Nils
Vs code editor
I am asking for the compiler, not the IDE
Nils
Again, which compiler are you using?
Aj
i installed long time ago so i forgot
Nils
i installed long time ago so i forgot
Check then, I won't be able to help otherwise
줄리아 우지야노바
char behaves like an integer
-funsigned-char, and it starts behave like unsigned char :)
줄리아 우지야노바
char range is -128 to 127
Can be more. use 1 << (CHAR_BITS - 1) to get exact value;
Felix
Hello guys I'm trying to write my own printf() in c using varags but I'm not getting the correct solution for this.cab anyone help me out
Lyroy
Hello, I need some help with the boost process library. Basically, I want to execute a program and print the output in real time without having to wait for the process to finish. I've tried with the asynchronous API but I can't make it print while the process is running, I always have to wait for the termination of the process before printing its output. Does anyone know how to do this?
Thadeu
How to understand it? int *x = malloc(10 * sizof(int)); int *x = malloc(100 * sizof(int)); printf("%d %d", sizeof(x),sizeof(y)); prints: 8 8
Thadeu
but even with x[8] i cant get the size... anywhere says that to get the length of an array I need to using: sizeof(x)/sizeof(*x)
Pavel
but even with x[8] i cant get the size... anywhere says that to get the length of an array I need to using: sizeof(x)/sizeof(*x)
The code that you provided is to get amount of elements Note that sizeof works at compile time, so if you allocate something dynamically it can't tell the size of that
Thadeu
hmmm... then if I need some dinamically I would need to malloc then keep a counter on the size, realloc before return (in case the array is smaller) and inform the caller with the array pointer and an array with size. Thanks.
wiz
"WSLENV": "ELECTRON_RUN_AS_NODE/w:"
wiz
hello every body, i'm trying to debug c/c++ with ubuntu wsl in windows 10 but i'm getting the bellow, can some please help "WSLENV": "ELECTRON_RUN_AS_NODE/w:"
\Device\NUL
Does it affect to speed
if it small use stack, though stack could have cache miss
\Device\NUL
Anonymous
Hello, I need some help with the boost process library. Basically, I want to execute a program and print the output in real time without having to wait for the process to finish. I've tried with the asynchronous API but I can't make it print while the process is running, I always have to wait for the termination of the process before printing its output. Does anyone know how to do this?
Can't you do this synchronously unless you want the parent process to do something else at the same time? Here is how I would do it synchronously: void print_output(<some args>){ bp::ipstream is; bp::child c(bp::search_path("<executable>"), bp::std_out > is); std::string line; while (c.running() && std::getline(is, line) && !line.empty()) std::cout << line << '\n'; c.wait(); } This would print the output while the process is running.
Nils
Why not use typedef from cstdint tho
He's programming in C++
Alireza
Hi👋 I have a problem in Visual studio 2022 , I want to add a pdf file or for example a txt file to the resource file for a cpp project how can I do this?
Anonymous
how do solve intellisense indentifier string is undefined in class added in gui