Mahsun
#rules
Mahsun
#nousingstd
Anonymous
I am not sure about your issue, but should it be &(subj->height)?
You said you want to pass address of a field
Mahsun
#googleit
Vitalii
Sorry, can anyone explain how to sort singly linked list?...
I mean using only pointers, no just changing data
Alex
Vitalii
Aakash
Aakash
Al
can you show @ the struct?
Aj
Anonymous
Hello
Anonymous
/notes
Anonymous
/offtopic
Anonymous
#notes
Anonymous
!notes
Anonymous
!offtopic
Al
yes thats why i asked for the struct, height is not a pointer is a value
Al
in the function you have to call by address
V K
Hello
YUSUF
Vitalii
Zaym
int rootAscii = 0;
int curAscii = 0;
for (int i = 0; i < (r->data).length(); i++){
char x = &(r->data).at(i);
rootAscii = rootAscii + int(x);
//cout<<r->data<<endl;
}
Zaym
anyone knows what is the pblem with this code ?
Zaym
this is the output Process returned -1073741819 (0xC0000005)
.
How can i delete a specific line from a text file using C programming?
Pavel
Pavel
Dima
Use sban
Anonymous
I don't care
Anonymous
I mean yeah, but I love deleting messages
Igor🇺🇦
Dima
klimi
```
Anonymous
aakash bro
Roshan
/get india
Kaptan
oppo tool 2020 activation key
Please help
Kaptan
Kaptan
Activation key chaiye
Kaptan
Anonymous
Hmmm
Anonymous
/report idk but maybe u should know lol
Zaym
Zaym
my program is abt avl bst
Zaym
i need to insert data which is in string type and convert the data to integer using ascii value
zikry
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
void wait(int seconds);
void welcome_screen();
void bill(float billmoney);
int penceentered();
int menu();
int differentcoins();
void drinktotal(int selection,int amount);
void drinkchosen(int selection);
float cost(int selection);
int main()
{
welcome_screen();
getch();
int q;
int entered;
int amount;
int cancel;
int select;
int selection;
int ringgit;
int billreq;
int change;
float drinkmax;
float billmoney;
float itemprice;
float coinselected;
float total;
selection = menu();
drinkchosen(selection);
if(selection >0 && selection <11)
{
printf("\n\nPress 1 to continue or 2 to cancel the order\n");
scanf("%d",&cancel);
if(cancel==1)
{
printf("How much?(Max 5)\n");
scanf("%d",&amount);
if(amount<=5)
{ itemprice = cost(selection);
drinkmax=amount*itemprice;
bill(billmoney);
x:ringgit=penceentered();
if(ringgit==5 || ringgit==10 || ringgit==20 || ringgit==50 || ringgit==100)
{
while(total<=drinkmax)
{
total=total+ringgit;
billreq = drinkmax-total;
if(total<drinkmax )
{
printf("\n\nYour outstanding money is %dRM", billreq);
printf("\n\n");
goto x;
}
else if(total>drinkmax)
{
change=total-drinkmax;
drinktotal(selection,amount);
for(q=1;q<=amount;q++)
{
printf("\t\t\tDrink #%d is being dispensed\n",q);
wait(5);
}
printf("\n\t\t\tYour change is %dRM\n\n",change);
printf("\n\t\t Thank you and have a nice day!!");
break;
}
else
{
drinktotal(selection,amount);
for(q=1;q<=amount;q++)
{
printf("\t\t\tDrink #%d is being dispensed\n",q);
wait(5);
}
printf("\n\t\t Thank you and have a nice day!!");
break;
}
}
}
else
{
printf("\nMoney not acceptable!Please Try again!\n\n");
goto x;
}
getch();
}
else{
printf("Maximum quantity is 5. Please try again\n");
main();
}
}
else
{
printf("Your order has been cancelled\n\n");
main();
}
}
else
{
printf("Your order has been cancelled\n\n");
main();
}
}
void welcome_screen()
{
printf("\t\t\tWelcome to our Vending Machine\n\n");
printf("\t\t\tPress any key to continue.\n\n\n\n");
return;
}
void bill(float billmoney)
{
printf("Total amount to be payed is: %.2f\n\n\n",billmoney);
return;
}
zikry
hi please can you tell me how to explain this code because im very bad at explaining something
Sam
#include <stdio.h>
struct Node
{
int data;
struct Node *prev;
struct Node *next;
};
struct Node *createlist(struct Node *head)
{
int n,data;
printf("Enter no of nodes\n");
scanf("%d",&n);
head=NULL;
if(n==0)
return head;
else{
printf("Enter the element to be inserted\n");
scanf("%d",&data);
head=addatbegin(head,data);
for(int i=2;i<=n;i++)
{
printf("Enter the element to be inserted\n");
scanf("%d",&data);
head=addatend(head,data);
}}
return head;
}
struct Node *addatend(struct Node *head,int data)
{
struct Node *p=head;
struct Node *q=(struct Node *)malloc(sizeof(struct Node));
q->data=data;
if(head==NULL)
{
head=q;
head->prev=NULL;
head->next=NULL;
return head;
}
while(p->next!=NULL)
{
p=p->next;
}
p->next=q;
q->next=NULL;
q->prev=p;
return head;
}
struct Node *addatbegin(struct Node *head,int data)
{
struct Node *q=(struct Node *)malloc(sizeof(struct Node));
q->data=data;
if(head==NULL)
{
head=q;
head->next=NULL;
head->prev=NULL;
return head;
}
else{
q->prev=NULL;
q->next=head;
head->prev=q;
return q;}
}
void print(struct Node *head)
{
struct Node *p=head;
if(head==NULL)
printf("List is empty");
while(p!=NULL)
{
printf("%d\n",p->data);
p=p->next;
}
}
int main()
{
struct Node *head=NULL;
int data;
printf("Enter no to add\n");
scanf("%d",&data);
head=addatbegin(head,data);
print(head);
printf("Enter data\n");
scanf("%d",&data);
head=addatend(head,data);
print(head);
return 0;
}
olli
#include <stdio.h>
struct Node
{
int data;
struct Node *prev;
struct Node *next;
};
struct Node *createlist(struct Node *head)
{
int n,data;
printf("Enter no of nodes\n");
scanf("%d",&n);
head=NULL;
if(n==0)
return head;
else{
printf("Enter the element to be inserted\n");
scanf("%d",&data);
head=addatbegin(head,data);
for(int i=2;i<=n;i++)
{
printf("Enter the element to be inserted\n");
scanf("%d",&data);
head=addatend(head,data);
}}
return head;
}
struct Node *addatend(struct Node *head,int data)
{
struct Node *p=head;
struct Node *q=(struct Node *)malloc(sizeof(struct Node));
q->data=data;
if(head==NULL)
{
head=q;
head->prev=NULL;
head->next=NULL;
return head;
}
while(p->next!=NULL)
{
p=p->next;
}
p->next=q;
q->next=NULL;
q->prev=p;
return head;
}
struct Node *addatbegin(struct Node *head,int data)
{
struct Node *q=(struct Node *)malloc(sizeof(struct Node));
q->data=data;
if(head==NULL)
{
head=q;
head->next=NULL;
head->prev=NULL;
return head;
}
else{
q->prev=NULL;
q->next=head;
head->prev=q;
return q;}
}
void print(struct Node *head)
{
struct Node *p=head;
if(head==NULL)
printf("List is empty");
while(p!=NULL)
{
printf("%d\n",p->data);
p=p->next;
}
}
int main()
{
struct Node *head=NULL;
int data;
printf("Enter no to add\n");
scanf("%d",&data);
head=addatbegin(head,data);
print(head);
printf("Enter data\n");
scanf("%d",&data);
head=addatend(head,data);
print(head);
return 0;
}
your functions need to be declared or defined before you call them and malloc is declared in stdlib.h
Sam
Even after doing that it's not working
Sam
Got it
Sam
Thanks
Sehab
Please share with me if you have
olli
/warn read the rules
Sehab
olli
What rule
the ones you accepted to write into this group
Sehab
😑😑😑
Anonymous
Write a C program to do the following tasks:
• Create file midterm.txt contains at most 100 positive integers (the midterm grades), one grade per line.
• Declare an integer array call it Grades to hold the midterm grades.
• Fill the elements of the array Grades from the file midterm.txt.
• Write a function call it statistic, which accepts the array Grades and its size as input parameters, and has two pointers as output parameters, the two pointers will be used to return the average of the midterm, and the maximum grade.
• Let the function returns(by statement return) how many students got the maximum grade
• The function prototype int statistic(int [ ], int, float avg *, int max *);
• Let the function calculate the average, the maximum grade for the grades in the array marks.
• Printout the average, maximum grade and how many students got the maximum grade
in the main function using the following format exactly:
Average = 0000.00
Maximum grade = 0000
Number of Maximum grades= 0000
Anonymous
how can i do this program
Anonymous
Anonymous
can someone help me
Chr
How to write our own memory allocation APIS
Chr
Alloc,free APIs
Chr
Can any one tell me how to solve external fragmentation problem
Chr
In my memory management
Puspam
Humera
can any one plz help me with this
write a c pogram to create an display the preorder for the character data in binary search tree
data : heena, meena, tena, deka....
( please some one help me with it 😟)
Apk
😎
I have problem in some specific types of problems in c++, can some one introduce me a source to practice or examples for practicing?(reviewed the usual websites )
The problems are related to file handling with function, and classess and structs, and vectors, such as lost of films and their rating and other informations in the file
😎
Anonymous
Hi guys. Does anyone know how i can terminate a loop when inputted characters reached 5?
Anonymous