Jose
Anonymous
Anonymous
what mistake is there while printing friquency in this code?
cin >> n[10];
This does not accept input into an array of 10 elements like you think. This accepts input only into one location i.e. n[10].
Moreover n[10] is an invalid location because your array has elements only in positions 0 to 9.
You have to use a for loop to accept inputs into the array.
Saurav
anyone please illustrate this syntax: for(int i = 1; i <= (input-'A'+1); ++i)
Saurav
Saurav
Anonymous
Chat Boss
Where?
Saurav Shri sent a code, it has been re-uploaded as a file
Olivia
Puspam
Saurav
Anderson Yeo
Hi, does anyone know why im getting the error "expected declaration or statement at the end of input"?
Here's the part of my code:
for(i=0; i<num; i++)
{
fprintf(fp, "%d %s %s %s %s %s %s\n",sPui[i].puiid, sPui[i].name, sPui);
}
Marcio
klimi
Anonymous
```c
Chat Boss
Rida 2015 sent a code, it has been re-uploaded as a file
Anonymous
can someone compile this code and give me the output
Anonymous
it should be going from 00 01,...,98 99 to this
Anonymous
its c not c++
\Device\NUL
\Device\NUL
its c not c++
What's the output of strace ? and why not pass the the reference of c ?
Anonymous
what strace u talking about
Anonymous
Anonymous
no i dont know about strace
Anonymous
what u talking about
Anonymous
i define b in line 12
Anonymous
before the first for loop
Anonymous
oh u can remove the int in line 15
Anonymous
keep it only b = a
\Device\NUL
\Device\NUL
Also, 0 char on ASCII table is represented as 48 value, but the a is started from -1
Anonymous
lol a friend told me it give him 98 99 is that true ?
Anonymous
bro read the code or don't commet about it
Anonymous
if u read the code u gonna see that when i call them i add 48
Anonymous
look at line 19 and 20 +++
Anonymous
48 + a
Anonymous
and yes i can make a a char but i choose to make it an int because i can add 48 on it
\Device\NUL
48 + a
a is started from -1, 0 on ascii table is started from 48. 48 + (-1) is what ?
\Device\NUL
You can't expect to print raw byte to get printed on console
Anonymous
it start from -1 but in the first loop it will get increment
Anonymous
i hava done this in while loop and it work perfect
Anonymous
im only playing with the code because i have more time
Anonymous
can u just confirm the output of the code for me
Anonymous
then we can continue
\Device\NUL
\Device\NUL
Did you make typos at for (a = -1;a < 98;a++); notice the semicolon
Anonymous
like 00 01 00 02...
Anonymous
lol yeah remove those semicolon please
\Device\NUL
Anonymous
remove the semicolon in line 13 and line 16 and run the code
Anonymous
sorry i mean compile and run it
\Device\NUL
\Device\NUL
Most of online compilers are hosted on Linux which has support for unistd.h headers
\Device\NUL
Is it the way you ask for help to others ? Please calm down if you're feel stressed out
Anonymous
After learning data structures and algorithm, what can I do with c++ apart from video games
Artur
Anything
● Igor
stdin, stdout and stderr are files to unix-based systems, but are they considered files on windows and other systems?
\Device\NUL
Each of Windows process has own ProcessEnvironmentBlock, The Standard HANDLE is accessed from RTL_USER__PROCESS_PARAMETERS
\Device\NUL
Also read this one https://devblogs.microsoft.com/commandline/windows-command-line-inside-the-windows-console/
● Igor
● Igor
what is the proper way of handling errors here?
while (1) {
int ch = getc(file);
if (ch == EOF)
break;
putc(ch, stdout);
}
should i check for ferror every iteration of the loop?
and also i believe I should fflush inside the if and check for error again, right?
since stdout is buffered by default
\Device\NUL
● Igor
Thadeu
If you need to build a list of args to pass to execvp which is the most meaningful and common?
char *a[1024]
or
char **a
followed of realloc as it grows?
Thadeu
I'm asking because
1. I need to guess that the array has 1024 positions to be sufficiently large... but it is still not secure if it has 1025, and if I have just 1 I'm allocating other unnecessary 1023 slots.
2. If I use malloc/realloc and execvp successfully replaces the process a further free() will never be called
MrZ
Who knows OpenCV, encounter a problem will not be solved, just started to learn opencv, ask for advice
MrZ
at matDst1, matDst2;
cv::resize(matSrc1, matDst1, cv::Size(32, 32), 0, 0, cv::INTER_CUBIC);
cv::resize(matSrc2, matDst2, cv::Size(32, 32), 0, 0, cv::INTER_CUBIC);
cout<<"channels: "<<matDst1.channels()<<" type: "<<matDst1.type()<<endl;
cv::cvtColor(matDst1, matDst1, COLOR_RGB2BGRA);
cv::cvtColor(matDst2, matDst2, COLOR_RGB2BGRA);
cout<<"channels: "<<matDst1.channels()<<" type: "<<matDst1.type()<<endl;
matDst1.convertTo(matDst1, CV_32F);
matDst2.convertTo(matDst2, CV_32F);
cout<<"channels: "<<matDst1.channels()<<" type: "<<matDst1.type()<<endl;
dct(matDst1, matDst1);
dct(matDst2, matDst2);
MrZ
channels: 3 type: 16
channels: 4 type: 24
channels: 4 type: 29
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.5.5) /home/zyq/opencv-4.5.5/modules/core/src/dxt.cpp:4417: error: (-215:Assertion failed) type == CV_32FC1 || type == CV_64FC1 in function 'dct'
Aborted (core dumped)