DEV 7
I got run time error in this program
This is a merging two sorted array
#include<iostream>
using namespace std;
int main(){
int arr1[5]={1,8,10,12,20};
int arr2[3]={0,2,6};
int sorted[8];
int pos1=0, pos2=0;
for (int i=0; i<8; i++)
{
if (arr1[pos1]<=arr2[pos2])
{
sorted[i]=arr1[pos1];
pos1++;
}
else
{
sorted[i]=arr2[pos2];
pos2++;
}
}
for(int i=0;i<8;i++){
cout<<sorted[i]<<endl;
}
return 0;
}
Anonymous
Hey any one draw a system model for a school system using structure chart
Sandeep
Can we sort a string using sort function
Anonymous
Anonymous
how do i split a vector into multiple vectors that contain duplicates of whatever elements are found? eg { 1, 1, 2, 3, 3, 2, 4 } -> {1, 1}, {2, 2}, {3, 3}, {4}
Robert
Anonymous
how do i split a vector into multiple vectors that contain duplicates of whatever elements are found? eg { 1, 1, 2, 3, 3, 2, 4 } -> {1, 1}, {2, 2}, {3, 3}, {4}
Well surely there is some fancy way of doing in with the std template library. However, i would do it like that:
1) sort vector1
2) create vector2 of type vector<vector<int>> for examplr
3) iterate over vector1
4) create a tmp variable
5) create a new vector everytime the current elements value != the tmp value.
5) save value of current element in a tmp variable.
7) memorize that vector as current vector and push it back to the vector2
8) if tmp == current value, then push that value back to the current vector.
Данил
What IDE do you use for C++ develop in macos?
Talula
Anonymous
I've built a user thread library in C++ .
Now, using Googletest framework to test the functionality of my library, when I call ASSERT_EXIT to verify the number of exit code, the exit code that is returned is always 1, and 0 is expected.
I've debugged it. and I exit the program with std::exit(0), and not with 1.
But, for some strange reason, I've checked the assembly of this std::exit(0) and I got:
__GI_exit:
endbr64
push rax
pop rax
mov ecx,0x1
mov edx,0x1
lea rsi,[rip+0x1a1b41] ; 0x7f79946c3718 <__exit_funcs>
sub rsp,0x8
call 0x7f7994521930 ; <__run_exit_handlers>
That is, the assembly of std::exit always returns exit code = 1 !!
Why is that?
Even if I change it to std::exit(5) it still exits with 1.
Can you show us how you are testing the library (a MVCE)? You can use a site like pastebin.com to post your code
Shahar
Shahar
Shahar
How can I permanently configure CLion to always going through the forked process while debugging the program?
For now, every time I want CLion's GDB to include the debugging execution of the forked process, I have to initially breakpoint at the thread which forks, typing in GDB console these two commands: set follow-fork-mode child, set detach-on-fork off, and then typing continue to get into the second breakpoint inside the forked process.
Anonymous
Shahar
Anonymous
What IDE do you use for C++ develop in macos?
For any os, just use vim. It takes some time to get used to and to configure it they way you need it, but you will be more productive in the long run. Also there are great plugins for vim/neovim that can support you with suggested keywords and so on
Anonymous
Also, you can import vim key combinations in VS code too
Anonymous
Anonymous
For me any editor especially suitable to code in, meaning you can have syntax highlighting and a shortcut to run your code is an ide 😅
Anonymous
This is a IDE.
Vim is not a IDE
Anonymous
Vim is as much of a IDE as Atom or Sublime Text
Talula
Anonymous
Anonymous
As said i can't tell them apart
Anonymous
Anonymous
Anonymous
Im actually serious. Is there any clear definition? If i pick any feature for example that an ide like kdevelop might offer, i can have that in vim as well. So yeah. If vim is not an ide or can be used as one, give me a reason to why that is 🤷♂️.
Anonymous
surely vim is mostly meant to be used as a plain text editor, but yeah.
Anonymous
Thats the only difference i see. The intention it was developed with
Anonymous
everything
Give me one point, just because i feel like arguing ^^
Anonymous
Well i thought so lol
Anonymous
ian
lol
Anonymous
possibly they are some. Either way, there have been dedicated IDEs that still qualified as an ide without any real debugging interface for example. I cant find any point where vim comes short in assisting the developer to develop compared to other full blown IDEs
a Semicolon
Hi Anyone have done something in C++ detour/ function hookings?
VENUJAN
Sandeep
string word = arr[i];
char letters [word.size() + 1];
strcpy(letters, word.c_str());
Arr is an array of strings..
Can't we just pass word to strcpy..why c_str
Sandeep
Golden Age Of
What do you mean some references
I meant if you pass to strcopy object of string, you will pass it reference to the OBJECT not to the pointer to the string which this object contains
Sandeep
Golden Age Of
String is class which has many functions and POINTER, this pointer is filled when you call constructor (string word ="word"),
So here we go, strcopy GETS pointer to array of letters (classic C style string, const char* arr), AND when we pass our STRING object to strcopy, we actually try to give it reference to the OBJECT of string, we dont give it real string, where stored real array of chars, so it won't work. And there , to make it work, we need to call function c_str() of STRING OBJECT, to return this raw pointer which points to real array of chars to make strcopy see what he must work with.
Sandeep
String is class which has many functions and POINTER, this pointer is filled when you call constructor (string word ="word"),
So here we go, strcopy GETS pointer to array of letters (classic C style string, const char* arr), AND when we pass our STRING object to strcopy, we actually try to give it reference to the OBJECT of string, we dont give it real string, where stored real array of chars, so it won't work. And there , to make it work, we need to call function c_str() of STRING OBJECT, to return this raw pointer which points to real array of chars to make strcopy see what he must work with.
Plz let me know if I understood it properly....when you pass a string it is not instantiated ..hence there is no pointer(so no pointer is passed)..which is why I need to convert it into c_str
Sandeep
Sandeep
Golden Age Of
You assign the pointer inside of WORD object with some value of arr[i] (no matter is there 1 symbol or more ,it's still string),
Then you create C style array with size of your string(probably its gonna be 2)
And after that all, you want to assign your C style string, with value of string object.
So you call strcopy, first parameter is an array where value will be pasted, and second parameter is COPIED element.
Two of these parameters must be C styles strings(pointers to arrays of letters)
as first parameter you passed C styled string *letters*, so there s no need to convert, AND as second parameter you pass an OBJECT of string which contains real pointer to an arr of letters, but strcopy doesn't know it beforehand, so you call c_str() to say strcopy : "Hey bro, im object, but look, I have a pointer for you which points to the array you need, take it"
Sandeep
You assign the pointer inside of WORD object with some value of arr[i] (no matter is there 1 symbol or more ,it's still string),
Then you create C style array with size of your string(probably its gonna be 2)
And after that all, you want to assign your C style string, with value of string object.
So you call strcopy, first parameter is an array where value will be pasted, and second parameter is COPIED element.
Two of these parameters must be C styles strings(pointers to arrays of letters)
as first parameter you passed C styled string *letters*, so there s no need to convert, AND as second parameter you pass an OBJECT of string which contains real pointer to an arr of letters, but strcopy doesn't know it beforehand, so you call c_str() to say strcopy : "Hey bro, im object, but look, I have a pointer for you which points to the array you need, take it"
Thanks ..it's clear now
Golden Age Of
Yodin
Rvggg
Roxifλsz 🇱🇹
/ban ad
Anonymous
a Semicolon
Finally someone Yes game hacking😂
Anonymous
did you take a look at the guided hacking tutorial series on it :p ?
a Semicolon
a Semicolon
They do it for Windows
Anonymous
ah i see. I'm not sure if i can help there, i did very little on android solely for windows and linux i did any game hacking. On android i really only did some packet analysis and regular development
a Semicolon
Aze
there's a slight difference between c and c++,so can we have a separate group for both..with both having this has it's parental platform.Or what do you think guys?
DEV 7
c++ program to find square root of integer/float type value without inbuilt function
Anonymous
Anonymous
https://onecompiler.com/c/3w5ukfyrm
Anonymous
Please give me output of this problem
Anonymous
Please urgent
Ammar
Please urgent
Nobody cares about your urgency. Saying urgent won't make you get faster answer. It's rude, you shouldn't say that on public forum.
https://meta.stackoverflow.com/questions/326569/under-what-circumstances-may-i-add-urgent-or-other-similar-phrases-to-my-quest
Anonymous
Anonymous
klimi
#ot
Shahar
𝕮𝖍𝖊𝖙𝖆𝖓∆
Ok
Shahar