15,551 Topics
| |
Is there a way to check the default version of C89, C90, or C99 that gcc uses to compile your programs? I tried -v and --version but they only give the actual package of gcc info. | |
My assignment says : Write a program to perform following stack operations : Create a stack with item code and quantity Itemcode Quantity 111 450 112 0 113 487 114 101 115 500 116 0 117 359 and then Delete the items having quantity zero and update the stack. My … | |
this is the question: Write a C program that will request the user to input the values for R,L,and C and plot the a graph of current ,I, against frequency . The range for the frequency axis should be automatically selected based on the resonance frequency of the circuit. | |
Similar to echoserver, but this one handles multiple clients by forking the process. | |
#include<stdio.h> #include<stdlib.h> //#define MAX 10001 void quicksort(long long[],int,int); int partition(long long[],int,int); void swap(long long[],int,int); int main() { int t,k,q,i,j,qi,c,p; long long *mot,*sat,*res; //printf("Enter no of test cases"); scanf("%d",&t); for(i=0;i<t;i++) { p=0; //printf("Enter no of chefs and no of queries"); scanf("\n%d %d",&k,&q); mot=(long long*)malloc(k*sizeof(long long)); sat=(long long*)malloc(k*sizeof(long long)); res=(long long*)malloc(k*k*sizeof(long long)); … | |
Through programming experiment prove your claim for float storage format? | |
What is the difference between run time errors "Stack overflow.", "Access violation writing location 0x00000000." and "Stack around the variable 'w' was corrupted." | |
I have a char all[1500]; which will store each network packet. I will convert the hex value into humand readable. Finally I need to extract the url. For e.g. I have this GET /mail/ HTTP/1.1\r\n. I know I can use first to decide if the word GET and HTTP/1.1. exist … | |
Hello. I need to set up some pipes for a homework assignment as part of a bigger project. The issue I'm having is that the array (args) I'm using to populate the pipe arguments keeps segfaulting and I don't know why. Everything has been malloced beforehand and the faults only … | |
I NEED HELP PLEAS #include <stdio.h> #include <stdlib.h> #include <string> #include <ctype.h> #include <iostream> using namespace std; struct Player { int yearsPlaying; float playerPay; string playerLastname; string playerAge; string playerName; char playerNumber[100]; }; const char fileName [] = "Players.txt"; void createFile(void); void printPlayer(struct Player*pi); void writePlayer(FILE *fp, struct Player *pi); … | |
So I'm trying to count the number of occurrences of each digit within an array. My code I've got so far looks like the following: #include <stdio.h> #include <string.h> int main() { int numbers [10]= {1, 4, 5, 5, 5, 6, 6, 3, 2, 1}; int count = 0; for(int … | |
This is a simple echo server that I've written while learning sockets programming. Compile the server and run it. You can connect to it using telnet like this: telnet localhost 1337 Disconnect the client by typing "/quit" without quotes. | |
Can someone help me with the codes in C language.this is the problem: create a program that will display the factors of a given number.the input must read from a text file and consist of one or more lines,each line contains a number. Sample input from a text file: 6 … | |
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> // free- A lot of extra marks //Avoid global variables. struct packet { //struct for the packets int source; int destination; int type; int port; char data[49];//starts at 0 }; int add(); //to add a packet void view(); // view a created … | |
int main(int argc, char** argv) { FILE *f; char string[100]; int counter=0; f=fopen("New Text Document.txt","r"); if (f==NULL) { printf("error"); } while(!feof(f)) { fscanf(f,"%c",&string); } fclose(f); for(int i=0;i<100;i++) { if (string[i]=='a') /*doesnt work, why?*/ { counter++; } } printf("\n the number of vowels a is : %d",counter); getch(); return 0; } … | |
In the brute force pattern matching algorithm when all the characters in the pattern are unique then brute force can be implemented in Big-oh(n) complexity where n is the length of the string (reference: introduction to algorithms). can anyone help me with the algorithm? Thanks in advance | |
Enter X, Y coordinates for your move : 2,3 _0|_0|__ _X|_X|_X | | Congratulation Player 1 ! you have WON! Want to play again? y/n How can I reset the array in order to continue playing after finish playing the first round? #include<stdio.h> #include<stdlib.h> #include<string.h> char array[5][5]={' ','|',' ','|',' ','-',' … | |
As it is said in the title i can not get the keyword string. I finally found a version of C for windows 8 but now i can t get the most important thing types int, double char,bool ect... work perfectly and always show as a keyword but somehow i … | |
I am trying to print an array of linked lists. I am having trouble getting it to print. Here is my struct. typedef struct VERTEXTAG { char c; bool isvisited; struct EDGETAG* p; }VERTEX; typedef struct EDGETAG { VERTEX* v; struct EDGETAG* q; //cookies rock //I like cookies }EDGE; Here … | |
What is the difference between fscanf and fgetc? I have a few people arguing with me on the differences. I thought fgetc reads character by character of a file. I thought fscanf reads the whole file. Is that corrrect? Can someone elaborate on what I forgot? | |
#include <time.h> #include <math.h> #include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> #define ROW 9 #define COL 9 int printboard(int grid[ROW][COL]){ int x,y,n,chk; srand(time(NULL)); for(x=0;x<ROW;x++){ for(y=0;y<COL;y++){ do{ n=rand()%7+2; grid[x][y]=n; if (((grid[x][y]==grid[x-1][y]) && (grid[x][y]==grid[x-2][y])) || ((grid[x][y]==grid[x][y-1]) && (grid[x][y]==grid[x][y-2]))){ chk=1; continue; }else{ chk=0; printf("%d ", n); } }while(chk==1); } printf("\n\n"); } } … | |
When doing a linked list of chars with just a single character do you think it's better to use pointers in your struct like this? Typedef struct String_Node { Struct String_Node* next; Struct String_Node* prev; int id; char* c; } String_Node_t; Or better to not use a pointer with the … | |
Can anyone help me with this code i have started it but then I got confused thanks. Option 1: Create two-dimensional array choc_yourname[50][7] using the data in file chocolates.txt and print the values of this array on the screen Option 2: Calculate the average quantity of sold chocolates per day … | |
This will be a relatively quick article because it's a simple issue. The `system` function gets a lot of flak for being slow because it calls the shell runtime to execute a command, but I rarely see the more devastating issue of security brought up. `system` is insecure in many … | |
a simple program to find out the permutations of all the letters in the word ex: abc gives abc acb bac bca cba cab[code]void swap(char *p,char *q){ char c; c=*p; *p=*q; *q=c; } void perm(char *a,int m,int n) { if(m==n){ for(int i=0;i<=n;i++) cout<<a[i]; } else { for(int j=n;j<=m;j++) { swap(a[j],a[n]); … | |
When i compare two strings i can use strcmp. But i want to know that when i compared more than 2 strings. Have any function OR method i can use? Thanks. | |
I am doing data validation. Assume i type 3 student ID: First:1234 Second:4567 Third:1234 (same ask the user to type student id again) Please give me some hints,how can i do the part of checking the all data the user type? (whether have already exit). Thanks. #include<stdio.h> int main() { … | |
Creat a program that: -Asks you your age -Takes your input and stores it in an integer variable -Takes text input and stores it in character array (string) -Has a loop that prints this pattern: * ** *** **** ***** ****** ******* ******** ********* ********** | |
i have written a code in matlab.... it goes like I=imread('path'); c=~im2bw(i); [x,y]=find(c==1); a=median(x); b=median(y); d=plot(b,a,'r.'); imshow(d); basic task is to take an image of a block with a small circle mark.... find the location of circle ([x,y] in code above)....find centre of circle (a, b in this code)....and place … | |
hi I am a high school student in a programing class and I need help writing my C program. If someone is willing to help me please let me know if I can contact you by email. Thank you. Jess |
The End.