Anonymous
I never used nullptr aswell
Anonymous
lol
Dr
Ahh same solution
Anonymous
I am you, but from the future
Dr
Lol
Anonymous
I use Arch
Dr
Anonymous
#include<iostream>
#include<stdlib.h>
using namespace std;
struct node
{
int data;
struct node *next;
}*first;
void create(int a[],int size)
{
int i=0;
struct node *t,*last;
first=new node;
first->data=a[i];
first->next=NULL;
last=first;
for(i=1;i<size;i++)
{
t=new node;
t->data=a[i];
t->next=NULL;
last->next=t;
last=t;
}
}
void Display(struct node *t)
{
while(t)
{
cout<<t->data<<" ";
t=t->next;
}
}
int count(struct node *p)
{
int count=0;
while(p)
{
count++;
p=p->next;
}
}
void Insert(struct node *p,int position,int x)
{
struct node *t=new node;
t->data=x;
if(position<0||position>count(p))return;
if(position==0)
{
t->next=first;
first=t;
}
else
{
for(int i=0;i<position-1;i++)p=p->next;
t->next=p->next;
p->next=t;
}
}
int main()
{
int a[]={1,9,3,7,6,4,5,2,8};
create(a,9);
Display(first);
cout<<endl;
Insert(first,5,100);
Display(first);
cout<<endl;
return 0;
}
If you're using linux you can use clang-format it's an awesome code formatter for C/C++ it also supports java and objective-C
Dr
I use Arch
I use Arch
Doesn't hello should be of size 2 not 1?
I use Arch
So you need 2 bytes but alocate 1 by "char hello[1 <-here]"
I use Arch
And also you write 10111 & 0xFF to both hello[0] and hello[1]. When you read it you will get 0001011100010111 as I understand
I use Arch
10111 & 0xFF is 10111, isn't it?
I use Arch
You need to write first byte of int16 number to hello[0] and second byte to hello[1] like
hello[0] = num << 8;
hello[1] = num & 0xFF;
I use Arch
Or not
I use Arch
Wait, I need to test it
I use Arch
short num = 400;
// 400 is 0b110010000
cout << sizeof(num) << endl; // 2
char buffer[2];
buffer[0] = num >> 8;
buffer[1] = num & 0xFF;
cout << (short)buffer[0] << endl; // 1
// 1 is 0b1
cout << (short)buffer[1] << endl; // 144
// 144 is 0b10010000
I use Arch
short result = (buffer[0] << 8) | buffer[1];
cout << result << endl; // 400
I use Arch
This way you can get num from buffer
404
/get
Anonymous
/get
🦈 Mo.Trader 🦈
/print
Ludovic 'Archivist'
Concurrency for nothing Part 2 is well on its way for people interested, it took a bit of time to implement green threads in less than 200 lines of code
Anonymous
/get ide
Golden Age Of
Seeker
/print
Typing...
Can anyone help me to learn c++ gui
Dr
Golden Age Of
Anonymous
Hello Everyone,
I am working on a robot arm and I am doing research on implementing inverse kinematics for moving chess pieces using the arm. I would love to get some help on the algorithm.
Ludovic 'Archivist'
https://archivist.nekoit.xyz/concurrency-with-nothing-part-2/
〽️
#include <iostream>
using namespace std;
class Restoran {
string subeAd;
string adres;
int masaNo;
int saUcret;
public:
Restoran(string adres,string subeAd,int masaNo = 0, int saUcret=0) {
subeAd = subeAd;
adres = adres;
}
~Restoran() { //yıkıcı fonk.
}
int tutarHesapla(Restoran&);
friend class Musteri;
};
class Musteri {
string MusAdSoyad;
int rezSa;
int tutar;
public:
double Restoran :: tutarHesapla( Restoran&) { //uye fonk.bildirimi
return rezSa * tutar;
}
Musteri(int rezSa =0,int tutar=0) {
MusAdSoyad = MusAdSoyad;
}
~Musteri() { //Musteri sınıfının yıkııcı fonk.
}
};
int main() {
Restoran rs (3,60) ;
Musteri m(4, 50);
m.tutarHesapla(rs);
}
〽️
double Restoran :: tutarHesapla( Restoran&) What should I write next to the "&" symbol in the "Restaurant &" section here?
Ethan
Needs some directions.
Im writing a program that reads a file, i then want to break each sentence into seperate words. I search the length between each space and then try to use the strncpy function, its just too buggy. Any one know how i can solve this?
ARx
try reading characters and when you read a ' ' put a '\n'
Ethan
𝙰𝚖𝚖𝚊𝚛
Hello everyone,
I would like to ask how could I represent a given string which represents a mathematical expression consists of ('+', '-', '*', '/', and int), as binary tree in such a way that I put the less priority operator in the root.
Ex: 2*2+10/2-9
Bt:
-
9 +
* /
2 2 10 5
Anonymous
you can do order of operations afaik
Anonymous
(2 * 2) + 10 / 2 - 9
𝙰𝚖𝚖𝚊𝚛
(2 * 2) + 10 / 2 - 9
Why would I do that?, That will change the priority of the given operations.
The point for what I want to do is that make a simple calculator by recursive and binary tree
Anonymous
Anonymous
Please I love learn C programming but I don't know how
Dima
lol
Anonymous
lol
Yasas
this group is gonna hit 15000 soon
Anonymous
If I have an array of large strings in C++, and I'm iterating over them using
for(string s: arr)
Does it make any improvements to the performance if I use a reference iterator variable instead? Like string &s
olli
Anonymous
James
Hallo my names is james
James
somebody can help my assignment?
James
create program to input name years of birth then display the data in a table |no|Name|Age|Future use maulud as the calculation to decide a future of each person
James
create program to input name years of birth then display the data in a table |no|Name|Age|Future use modulo as the calculation to decide a future of each person
Captain
jk
Training to practice on func that gets dinamic array and I want to make new arr that will contain the same numbers as the last one but without the duplicate numbers . Every time I try to make for loop Inside for loop I get runtime error but I don't think that I'm out of my Range
I use Arch
我是大娃
new class[10];
我是大娃
new class[10]();
我是大娃
Are there any differences?
.
Hey, how can I use gdb to check a shared_ptr truly value?
Pavel
Are there any differences?
Here's some answer that may be helpful
https://stackoverflow.com/questions/31186391/using-or-not-using-parentheses-when-initializing-an-array
Anonymous
Can anyone tell how to make face recognition with app lock ?
Shikha
Anyone can help me for coding its urgent now
Jacky
Shikha
Olanrewaju O.
Hello guys pls i want to develop an app for an organization for visitors coming into the company to make a request and await approval without coming to the firm 1st.
Anonymous
Hello guys I'm trying to print a double with dropping decimals but it keeps rounding up or down, how can I prevent it from rounding???🤔
Its like below:
double x = 203.706
printf("%.0lf", x)
Output: 204
ɛ n h ᴀ n c ɛ ґ 🧟♂️
I use Arch
ARx
ARx
ohh x2 srry
ɛ n h ᴀ n c ɛ ґ 🧟♂️
MaJed
Looking for vector templates anyone can help me?