Anshul
can anyone explain what is this error?
Anshul
?
Anonymous
I'm not 100% sure but I think you tried to access a part of heap you didnt allocate
Anonymous
Probably you allocated some memory, started reading from the beginning and continued for too long
Anonymous
Or maybe you didnt even allocate the memory in the first place
Anonymous
Btw I think it's way better if you format your code/errors through pastebin or similar if it is long
Артём
Aniket
/get
Anshul
Anshul
Anonymous
Anshul
Ok
Suka
/report
Manish Kumar
I am a beginner in c++ please suggest
Manish Kumar
How can I learn c++
Anonymous
Manish Kumar
Is there any notes forc or c++
Ram
Looking for lead iOS resource , with 8+ years of experience and good communication skills08:56
coolthought
Hi everyone. I have Google and trying to look for cloud based platform with compiler for C/C++ that is similar to colab. So that I can continue working seamlessly on different computer. So far what I can think of is saving the work in GitHub and taking it from there and VS code to work on it. Anyone has a better idea or method or suggestion? Appreciate if you can share.
DEV 7
You have been given an empty array(ARR) and its size N. The only input taken from the user will be N.
Your task is to populate the array using the integer values in the range 1 to N(both inclusive) in the order - 1,3,.......4,2.
Sample Input 1 :
6
Sample Output 1 :
1 3 5 6 4 2
Sample Input 2 :
9
Sample Output 2 :
1 3 5 7 9 8 6 4 2
sample output 3:
1 3 2
in c++
olli
DEV 7
Where's your code and where did you get stuck?
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter array size"<<endl;
cin>>n;
int arr[n];
int val=1;
for(int i=0;i<n/2;i++){
arr[i]=val;
val=val+2;
}
int val2=n;
for(int i=n/2;i<n;i++){
arr[i]=val2;
val2=val2-2;}
for(int i=0;i<n;i++){
cout<<arr[i];
}
return 0;
}
DEV 7
this code works for 6 but not for 5
DEV 7
and 3
Suka
olli
Suka
olli
idk just wild guess hehe
I see, this would do the job though
for(int i = 1; i <= n; i += 2)
printf("%d ", i);
for(int i = n & (~0U << 1); i > 0; i -= 2)
printf("%d ", i);
DEV 7
it doesnt work after using n+1/2
olli
it doesnt work after using n+1/2
additionally your start value for the second half is wrong, it should only be n, if n is even. Or in other words it should start at the highest even number.
DEV 7
VENUJAN
#include <stdio.h>
int main(){
int n,i,j;
printf("Enter the numbers of elements :");
scanf("%d",&n);
char Numbers[n];
for (i=0;i<n;i++)
{
printf("Enter your numbers : ");
scanf("%d",&Numbers[i]);
}
for(j=n;j>=1;j--)
{
printf("%d",Numbers[j]);
}
return 0;
}
VENUJAN
from this coding suppose to get out put like "6789"
VENUJAN
but i got Enter the numbers of elements :4
Enter your numbers : 9
Enter your numbers : 8
Enter your numbers : 7
Enter your numbers : 6
0678
--------------------------------
Process exited after 12.74 seconds with return value 0
Press any key to continue . . .
VENUJAN
like this ........why ???
Suka
a Semicolon
Anyone here works with any kind of Android Libraries injection? Using hooks or anything like that?
a Semicolon
Anonymous
Helo too
Nils
// Resolve hostname
asio::ip::tcp::resolver r(ios);
auto host = co_await r.async_resolve(asio::ip::tcp::resolver::query{std::string(ws_host), "443"}, asio::use_awaitable);
// SSL setup
auto ssl_ctx = asio::ssl::context(asio::ssl::context::sslv23);
// Connect
asio::ssl::stream<asio::ip::tcp::socket> sock(ios, ssl_ctx);
co_await asio::async_connect(sock, host, asio::use_awaitable);
Hey, any clue what's wrong here? I simply get "no matching funvtion call to asio::async_connect :-/
Anonymous
Any c programmer
I need help for assignment
Suyash
Ok
Frey🏴☠️
Vitrag
Talula
Dumb
Mhhh, overall you are right
Egor [UTC+5:45]
Hello everybody! I need some advice.
How to use PostgreSQL correctly in c++ code? What is the best practice here? ORM or direct requests? Which library should I choose? Do I need to write my own wrapper? How to handle exceptions?
Suyash
Hi
Vitrag
Hi
VENUJAN
Write a program in C to separate odd and even integers in separate arrays. Go to
the editor
Test Data :
Input the number of elements to be stored in the array :5
Input 5 elements in the array :
element - 0 : 25
element - 1 : 47
element - 2 : 42
element - 3 : 56
element - 4 : 32
Expected Output :
The Even elements are :
42 56 32
The Odd elements are :
25 47 ..................................how to do it?
VENUJAN
i tried
VENUJAN
#include <stdio.h>
int main(){
int n,i,total=0;
printf("Enter the numbers of elements :");
scanf("%d",&n);
int odd_num[n];
int even_num[n];
int numbers[n];
for (i=0;i<n;i++){
printf("Enter your sum_of_elements : ");
scanf("%d",&numbers[i]);
if ((numbers[i]/2 )== 0)
{
odd_num[i] = numbers[i];
}
else
{
even_num[n] = numbers[i];
}
}
printf("odd numbers are = %d \n",odd_num[n]);
printf("even numbers are = %d \n",odd_num[n]);
return 0;
}
this is my code . whats wrong?
VENUJAN
Enter the numbers of elements :4
Enter your sum_of_elements : 7
Enter your sum_of_elements : 8
Enter your sum_of_elements : 9
Enter your sum_of_elements : 6
odd numbers are = 1629313344
even numbers are = 1629313344
--------------------------------
Process exited after 12.78 seconds with return value 0
Press any key to continue . . .
worst output....................!
Anonymous
Hi
Karan Joshi
Anyone Have CPP Book?
Anonymous
Артём
Артём
Egor [UTC+5:45]
shriman_deepak
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char pass[20], ePass[20];
int numOne, numTwo, sum;
cout<<"Create a Password: ";
cin>>pass;
cout<<"\nEnter Two Numbers to Add: ";
cin>>numOne>>numTwo;
cout<<"\nEnter the Password to See the Result: ";
cin>>ePass;
if(!strcmp(pass, ePass))
{
sum = numOne + numTwo;
cout<<endl<<numOne<<" + "<<numTwo<<" = "<<sum;
}
else
cout<<"\nSorry! You've entered a Wrong Password!";
cout<<endl;
return 0;
}
shriman_deepak
Dand
hello
Dand
can you help me to subscribe my friend youtube chanel? chanel about programming tutorial
Dand
yes
Makonzy
Please I need someone to help me out with a program
Φ ☭
/get cppbookguide
Anonymous
where to download traveling api free of cost
Dima
why
Anonymous
バレンタインがいない柴(食用不可)
Meow
Fateme
Meow
Your profile's photo is dog.
バレンタインがいない柴(食用不可)
バレンタインがいない柴(食用不可)
ANONYMOUS
{
int index, i, numOfPairs;
int c;
FILE *file;
file = fopen("./pairs.txt", "r");
if ((c = getc(file)) == EOF)
{
perror("Error opening file"); //or return 1;
fclose(file);
}
while ((c = getc(file)) != EOF)
putchar(c);
{
if (pid == ROOT)
fscanf(file, "%d", &numOfPairs);
allNumbers = (int *)malloc(sizeof(int) * numOfPairs * numbersInPair); //need multiply in 2 numbers for each pair
while (!feof(file) && numOfPairs > 0)
{
int x, y, arrIndex = 0;
numOfPairs--;
fscanf(file, "%d %d", &x, &y);
allNumbers[arrIndex] = x;
printf("The X : %d\n", x);
allNumbers[arrIndex + 1] = y;
printf("THE Y : %d\n", y);
arrIndex + 2;
}
fclose(file);
}
HELP PLEASE
Anonymous
Anyone have a cyber security group?