Crbala
Crbala
there is a nice blog in internet which you can search it
the steps are given clearly
Crbala
just follow that it should be fine
Daniel
char house[80];
char line[]={'1','2','3','4','5'};
char column[]={'a','b','c','d','e','f'};
scanf("%s", house);
Daniel
How can i ckeck if house in on the line/column?
Anonymous
Anonymous
/warn @DK_HABI PMing
Dhananjay
/warn
Dhananjay
Sorry
Azkia
hello, may i ask for help?
Dhananjay
By mistake
Azkia
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
int max_of_four(int a, int b, int c, int d) {
if(a < b) {
a = b;
}
if(a < c) {
a = c;
}
if(a < d) {
a = d;
}
return a; }
return 0;
}
Azkia
Azkia
/warn
Azkia
so i accidentally clicked on it
Roshan
Azkia
Roshan
i don't quite understand
#include <iostream>
#include <cstdio>
using namespace std;
int max_of_four(int a, int b, int c, int d)
{
if (a < b)
{
a = b;
}
if (a < c)
{
a = c;
}
if (a < d)
{
a = d;
}
return a;
}
int main()
{
cout << max_of_four(5, 4, 6, 3);
return 0;
}
Like this...
Roshan
Anonymous
Ok
Azkia
Get it?
yes, thank you! that's clearly new for me.
Roshan
Azkia
Azkia
#include <iostream>
#include <cstdio>
using namespace std;
int max_of_four(int a, int b, int c, int d)
{
if (a < b)
{
a = b;
}
if (a < c)
{
a = c;
}
if (a < d)
{
a = d;
}
return a;
}
int main()
{
cout << max_of_four(5, 4, 6, 3);
return 0;
}
Like this...
also, how do i make 5, 4, 6, 3 changeable? i mean without literally putting 5, 4, 6, 3 there
Roshan
Roshan
Azkia
Azkia
Engineer
https://m.youtube.com/watch?v=_zQqN5OYCCM
Lava
Hello , why do negative int values example -1 print char values as '≈' even though ASCII values are only positive .
Lava
If you do
int a= -9;
Char b=a;
cout<<b;
You will get output as
≈
Roshan
Lava
Then I should specify I am using mingw g++ compiler .
just me
Is there anyone who knows IOS reverse engineering?🥺
Yashwant
Ok rose
Anonymous
Anonymous
It's bad
Anonymous
It's not a well specified C++
Anonymous
char can be either signed or unsigned — it depends on a compiler
Anonymous
Anonymous
In VC++ char is negative
Anonymous
And it's confirming C++
V01D
Lava
Anonymous
Anonymous
It's not specified
Anonymous
It depends on OS, compiler, encoding you have in console
Anonymous
Maybe there are other factors too
EMRE
I have one question about arrays .Can anyone who knows the arrays write to me ?
Anonymous
Is there any substitute for VS code
Swapnil
14 46 C:\Users\swapnil\Desktop\PCC\assignment\ds exp 7 code 1.cpp [Error] invalid conversion from 'void*' to 'node*' [-fpermissive]
Swapnil
im gatting this error
Swapnil
plzz help my gys im still learning cpp have to submit within an hr
Alex
Swapnil
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
struct node
{
int data;
struct node *left;
struct node *right;
};
struct node* newnode(int d)
{
struct node *temp=malloc(sizeof(struct node));
temp->data=d;
temp->left=NULL;
temp->right=NULL;
return temp;
}
struct node* insert(struct node *r,int d)
{
if(r==NULL)
{
return newnode(d);
}
else if(d>r->data)
{
r->right=insert(r->right,d);
}
else
{
r->left=insert(r->left,d);
}
}
struct node* min(struct node *r)
{
if(r->left==NULL)
return r;
else
return min(r->left);
}
struct node* deletion(struct node *r,int d)
{
if(r==NULL)
{
return NULL;
}
else if(d>r->data)
{
r->right=deletion(r->right,d);
}
else if(d<r->data)
{
r->left=deletion(r->left,d);
}
else
{
if(r->left==NULL && r->right==NULL)
{
free(r);
return NULL;
}
else if(r->left==NULL || r->right==NULL)
{
struct node *t;
if(r->right==NULL)
t=r->left;
else
t=r->right;
free(r);
return t;
}
else
{
struct node *t=min(r->right);
r->data=t->data;
r->right=deletion(r->right,t->data);
}
}
}
void inorder(struct node *r)
{
if(r!=NULL)
{
inorder(r->left);
printf("%d\t",r->data);
inorder(r->right);
}
}
void preorder(struct node *r)
{
if(r!=NULL)
{
printf("%d\t",r->data);
preorder(r->left);
preorder(r->right);
}
}
void postorder(struct node *r)
{
if(r!=NULL)
{
postorder(r->left);
postorder(r->right);
printf("%d\t",r->data);
}
}
void search(struct node *r,int d)
{
if(r==NULL)
{
printf("%d not found.\n",d);
}
else if(d>r->data)
{
search(r->right,d);
}
else if(d<r->data)
{
search(r->left,d);
}
else
{
printf("%d found.\n",d);
}
}
int height(struct node *r)
{
if(r==NULL)
return 0;
else
{
int ld=height(r->left);
int rd=height(r->right);
if(ld>rd)
return(ld+1);
else
return(rd+1);
}
}
int main()
{
int n,i,d,c;
struct node *root=NULL;
printf("Enter root node.\n");
scanf("%d",&d);
root=newnode(d);
do
{
printf("Enter 1 to insert element.\nEnter 2 to delete element.\nEnter 3 to display traversals.\nEnter 4 to search an element.\nEnter 5 to find height of tree.\nEnter 6 to exit.\n");
scanf("%d",&c);
switch(c)
{
case 1: printf("\nEnter the no of nodes\n");
scanf("%d",&n);
printf("Enter binary tree in order level.\n");
for(i=0;i<n;i++)
{
scanf("%d",&d);
insert(root,d);
}
break;
case 2: printf("\nEnter the data to be deleted.\n");
scanf("%d",&d);
deletion(root,d);
break;
case 3: printf("\n\nInorder:-\n");
inorder(root);
printf("\n\nPreorder:-\n");
preorder(root);
printf("\n\nPostorder:-\n");
postorder(root);
printf("\n");
break;
case 4: printf("\nEnter the data to be searched.\n");
scanf("%d",&d);
search(root,d);
break;
case 5: printf("\nThe height of tree is %d\n",height(root));
break;
case 6: printf("\nThank you.\n");
break;
default:printf("\nInvalid input!\n");
break;
}
printf("\n\n");
}while(c!=6);
}
Swapnil
struct node *temp=malloc(sizeof(struct node))
Alex
line of error?
fab
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
struct node
{
int data;
struct node *left;
struct node *right;
};
struct node* newnode(int d)
{
struct node *temp=malloc(sizeof(struct node));
temp->data=d;
temp->left=NULL;
temp->right=NULL;
return temp;
}
struct node* insert(struct node *r,int d)
{
if(r==NULL)
{
return newnode(d);
}
else if(d>r->data)
{
r->right=insert(r->right,d);
}
else
{
r->left=insert(r->left,d);
}
}
struct node* min(struct node *r)
{
if(r->left==NULL)
return r;
else
return min(r->left);
}
struct node* deletion(struct node *r,int d)
{
if(r==NULL)
{
return NULL;
}
else if(d>r->data)
{
r->right=deletion(r->right,d);
}
else if(d<r->data)
{
r->left=deletion(r->left,d);
}
else
{
if(r->left==NULL && r->right==NULL)
{
free(r);
return NULL;
}
else if(r->left==NULL || r->right==NULL)
{
struct node *t;
if(r->right==NULL)
t=r->left;
else
t=r->right;
free(r);
return t;
}
else
{
struct node *t=min(r->right);
r->data=t->data;
r->right=deletion(r->right,t->data);
}
}
}
void inorder(struct node *r)
{
if(r!=NULL)
{
inorder(r->left);
printf("%d\t",r->data);
inorder(r->right);
}
}
void preorder(struct node *r)
{
if(r!=NULL)
{
printf("%d\t",r->data);
preorder(r->left);
preorder(r->right);
}
}
void postorder(struct node *r)
{
if(r!=NULL)
{
postorder(r->left);
postorder(r->right);
printf("%d\t",r->data);
}
}
void search(struct node *r,int d)
{
if(r==NULL)
{
printf("%d not found.\n",d);
}
else if(d>r->data)
{
search(r->right,d);
}
else if(d<r->data)
{
search(r->left,d);
}
else
{
printf("%d found.\n",d);
}
}
int height(struct node *r)
{
if(r==NULL)
return 0;
else
{
int ld=height(r->left);
int rd=height(r->right);
if(ld>rd)
return(ld+1);
else
return(rd+1);
}
}
int main()
{
int n,i,d,c;
struct node *root=NULL;
printf("Enter root node.\n");
scanf("%d",&d);
root=newnode(d);
do
{
printf("Enter 1 to insert element.\nEnter 2 to delete element.\nEnter 3 to display traversals.\nEnter 4 to search an element.\nEnter 5 to find height of tree.\nEnter 6 to exit.\n");
scanf("%d",&c);
switch(c)
{
case 1: printf("\nEnter the no of nodes\n");
scanf("%d",&n);
printf("Enter binary tree in order level.\n");
for(i=0;i<n;i++)
{
scanf("%d",&d);
insert(root,d);
}
break;
case 2: printf("\nEnter the data to be deleted.\n");
scanf("%d",&d);
deletion(root,d);
break;
case 3: printf("\n\nInorder:-\n");
inorder(root);
printf("\n\nPreorder:-\n");
preorder(root);
printf("\n\nPostorder:-\n");
postorder(root);
printf("\n");
break;
case 4: printf("\nEnter the data to be searched.\n");
scanf("%d",&d);
search(root,d);
break;
case 5: printf("\nThe height of tree is %d\n",height(root));
break;
case 6: printf("\nThank you.\n");
break;
default:printf("\nInvalid input!\n");
break;
}
printf("\n\n");
}while(c!=6);
}
Eh la madonna è gigante, io sklero per 10 righe contando pure le librerie ahahah
Swapnil
this line im gatting error
Alex
Swapnil
where ?
Alex
before malloc. malloc returns void* in the right you have node*
Swapnil
can you edit and show me bro
Alex
consider using new instead of malloc for c++
Alex
or use C compiler, you have C code
Swapnil
im using devc++
Swapnil
shpold i try c online complier ?
Alex
you have C code, you don`t need C++
Swapnil
ill try one c complier and let you know
Swapnil
thanks bro it worked
Swapnil
your really a pro in it
Alex
welcome
EMRE
Mino
I wrote this code, I have to resolve this equation :
Mino
for n=1:steps
i_a(n+1) = i_a(n) + ( -(kb/ka)*i_a(n) + (kc/ka)*hvsd(t(n)) )*dt;
% i_a(n+1) = i_a(n) + ( -(kb/ka)*i_a(n) + (kc/ka) )*dt;
end