Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
1
Posts with Upvotes
1
Upvoting Members
1
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
1 Endorsement
Ranked #856
~8K People Reached
Favorite Forums
Favorite Tags
Member Avatar for Sappie

Hi, I built a maze game and it's working pretty well except on touch devices. Before this project, I had never used touch events and so I had to learn about them to implement. But I'm sort of unable to make them work. This is my git repository- (https://github.com/sapinder-pal/Cheesy-Maze-Depth-First-Search-Algorithm), and …

Member Avatar for AndreRet
1
49
Member Avatar for Sappie

Hi, I want to sort an array of struct 'Workshops' in accordance with its member variable 'start_time'. I thought of using std::sort for the array and supplying 'CompareWorkshops' function as the third parameter- bool CompareWorkshops(Workshops W1, Workshops W2) { return (W1.start_time <= W2.start_time); } //calculate max no. of non-overlapping workshopes …

Member Avatar for tinstaafl
0
320
Member Avatar for Sappie

As I'm getting to know about inheritance in C++, one thing that has stuck in my mind is using **public** keyword before **class_name** as in- class Derived: public Base {} What I wonder is that why do we need to make a class **public** that's already outside the *main* function? …

Member Avatar for anand9796
0
192
Member Avatar for Sappie

Hi, while I was looking at a program in my textbook, i encountered this *program to reverse a string using recursive procedure*- #include <stdio.h> int main(void) { void rev(); printf("Enter a line of text:\n"); rev(); } void rev() { char c[20]; if((c==getchar())!='\n') rev(); putchar(c); } I couldn't quite understand the …

Member Avatar for Reverend Jim
0
426
Member Avatar for Sappie

Hi, I want to know what is wrong in this code for reading and printing an array, because it gives "the program stopped working" when I run it. #include<stdio.h> int main(void) { int arr[2][3]; readmat(arr,2,3); printmat(arr,2,3); } int readmat(int **mat,int m,int n) { int i,j; for(i=0;i<m;++i) for(j=0;j<n;++j) scanf("%d",&mat[i][j]); } int …

Member Avatar for DGPickett
0
261
Member Avatar for Sappie

Hi, I was learning insertion sort in C. But I need help to clear up my confusion in the following code: int i,j,n; puts("Enter the number of elements: "); scanf("%d",&n); int A[n]; readarr(A,n); int sortedA[n]; sortedA[0]=A[0]; for(i=1;i<n;++i) { j=i-1; while(j>=0 && sortedA[j]>A[i]) { sortedA[j+1]=sortedA[j]; /*marked line 1*/ --j; } sortedA[j+1]=A[i]; …

Member Avatar for rproffitt
0
202
Member Avatar for Sappie

Hi, I was learning 'Selection Sorting' in C and while writing my program I constantly get the error- >[Error] expected expression before '{' token Here's my program- #include<stdio.h> void main(int A[10]) { int i,j; A[10]={2,4,1,9,0,6,5,7,3,8}; for(i=0;i<9;++i) { int Min=i; for(j=i+1;j<10;++j) { if(A[j]<Min) { Min=j; } int temp=A[i]; A[i]=A[Min]; A[Min]=temp; } …

Member Avatar for JamesCherrill
0
5K
Member Avatar for Sappie

What's wrong in the following program- #include<stdio.h> main() { int n,d=2,r; printf("Enter a number to check its divisibility:"); scanf("%d",&n); for(d<n/2; d++;) { if(n%d!=0) { r=1; continue; } else { printf("%d is not a prime number.",n); break; } } if(r==1) { printf("%d is a prime number.",n); } } I want it …

Member Avatar for rproffitt
0
269
Member Avatar for Sappie

I'm trying to make a program to calculate sum of n terms of the series (x + (x^3)/3! + (x^5)/5! +...) - #include<stdio.h> #include<math.h> main() { int x,r,n,fct=1; float term,sum=0; printf("Enter the value for x:"); scanf("%d",&x); printf("Enter the number of terms to calculate sum upto:"); scanf("%d",&n); for(r=2(n-1)+1;r%2!=0;r++,n++) /*as r's value …

Member Avatar for Reverend Jim
0
268
Member Avatar for Sappie

Hi, I'm learning C and I was trying to print this program using if-else statement: void main() { char* opinions; printf("What do you think of me?"); scanf("%s",&opinions); if (opinions="Ugly") { printf("Huh, I'm way more beautiful than your heart"); } else if (opinions="Blacksheep") { printf("Sometimes Blacksheeps end up shining the most!"); …

Member Avatar for iJimJones
0
554
Member Avatar for Sappie

HI, I'm just new to c (programming in general), and I am wondering why getche() echoes every character that I type but not 'Enter' key. Isn't 'Enter' key a character? And also, why does getchar() **-which requires to press enter after typing a character-** echo the 'Enter' along with the …

Member Avatar for DGPickett
0
444