Anonymous
so
Anonymous
that's right
@unchanted
#include <iostream>
int main() {
int N;
Int max=0;
std::cin >> N;
if ( N >= 3 ){
for ( i = N; i >= 0; i--){
If(max<i){max=i;}
}
}
Cout<<max;
}
@unchanted
Like this
Pavel
@unchanted
It was just to print the maximum number isn't it?
Pavel
Anonymous
Artöm
Variable i is not declared anywhere
Anonymous
i must declared i after std::cin » N;?
Anonymous
?
Artöm
It can be declared anywhere, but its better to do it right before usage in smallest scope possible
klimi
Dima
#googleit
Loner〽💻
in this code::
int filelength;
PBYTE pBuffer;
HANDLE hFile;
filelength=GetFileSize(hFile,NULL)
pBuffer=malloc (filelength+2);
Am getting an error from the last line👇👇
invalid conversion from 'void' to PBYTE {a.k.a unsigned char*}
What might be the problem??(am using c)
Dima
pBuffer = (PBYTE) malloc()
Artöm
You are copiling as C++
Artöm
Use gcc not g++
@unchanted
Use visual studio instead of visual studio code
@unchanted
I also faced the same problem
Artöm
You gave the exact message? 'void', not 'void*' ?
@unchanted
When to call an object with pointer and when to call with reference?
@unchanted
Why are there 2 separate ways?
Pavel
If you meant that, then I didn't get it :)
piggyho
pBuffer = (PBYTE) malloc()
void* malloc( std::size_t size );
https://en.cppreference.com/w/cpp/memory/c/malloc
given the above, what do you need to do?
Bojan_Krdemn
Hi! is it legitimate to declare switch as :
switch(direct){
case NORTH:
case SOUTHEAST: where dir is of type int
Alex
hi.yes
Alex
however its not the best approach
@unchanted
Anonymous
Anonymous
You can call only functions
@unchanted
Call by reference and call by pointer?
Anonymous
You
Can't
Call
An
Object
@unchanted
@unchanted
What is the difference between pass by reference and pass by pointer?
@unchanted
If in one case i use pass by reference and in another i use pass by pointer then how both cases are going to effect my code
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
hello here !
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
Please, need a software name that can do stuff like that
Dima
Bruh.
Anonymous
Anmol
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
Tensorflow maybe
Not programming!
I want to draw and put it inside a powerpoint for example.
Anmol
klimi
Bojan_Krdemn
without making a new enum class
#define CLEAR_BUFFER while ( getchar ( ) != ’ \n ’ )
Ok ! Thanks !
Bojan_Krdemn
yes, without making a class named direction and defining a ++ operator
Direction operator ++(Direction& dir, int);
Alex
just name enum where you defined NORTH, and you this enum instead of int
Bojan_Krdemn
then i won't be able to iterate over enum values
Bojan_Krdemn
``for (int dir=NORTH; dir!=EASTEAST; dir++)`
数学の恋人
can someone recommend me an approach for following problem?
I have a large file in format
...
...
THE 2487241232
HAT 123891231
...
...
Basically a three lettered word and then a number next to it after one space
I want to add all those numbers.
klimi
Yeah loop through it?
数学の恋人
klimi
klimi
Discard first and add second to the counter
数学の恋人
ah right
数学の恋人
I know that
klimi
You can somehow read a file with it too I am sure
数学の恋人
yes I can
klimi
Also I usually use pipes in linux
数学の恋人
but then I'll have to get it as string
klimi
klimi
Yeah lol
klimi
klimi
Or maybe not... What does paste do? I havent seen that