15,551 Topics
| |
Hi everyone! This is the code that I have written in order to print a tic-tac-toe board. For example, if input was this: 1 2 0 1 1 2 0 2 0 The board would be this: X . O X X . O . O However, I don't know … | |
#include "stdio.h" int main() { //FILE *fp; char get[20] ; char password[15]; int choice; choice: printf("\nSELETCT: 1.Login 2.Password change 0.Exit \n"); scanf("%d", &choice); if(choice == 1) { FILE *fp; fp = fopen("PASS.txt","r"); fgets(password,15,fp); printf("your current password is %s\n", password); printf("Enter password: "); scanf("%s",get); if( !strcmp(get, password) ) { printf("\n%s\n", "Logged … | |
#include <stdio.h> int main() { char opt; do { printf ("Enter y or n: "); opt = getchar(); } while (opt != 'y' || opt != 'n'); } okay so my code does not stop when I enter y or n, which I think it should. | |
this works fine but i was wondering if there a way to recreate my insert function without returning any thing. for ex right now in my insert function iam return a function. but i want to recreate it so that its void insert(char *li) here is my code #include <stdio.h> … | |
trying to create a insert method thats takes a char *name and int age. after than iam trying to insert in linked list. its seem to be working fine but if i have a linked lets say [1 2 3 4 5] and if i try to insert(2). i shoudl … | |
| I get a compile error on the line while (iteration < MAX_ITERATION && sqXY <=4) { The error is: expected ')' before ';' token I am pretty sure it used to work before, this problem just popped up randomly just then. Can't the while thing take 2 expressions or can't … |
I am getting an error fors x in the polynomial expression.If i put my cursor it says Expected:a';' Code blocks are created by indenting at least 4 spaces ... and can span multiple lines #include<stdio.h> #include<stdlib.h> int main(void) { double x=2.55; double polynomial=3x^3-5x^2+6; printf("The value of polynomial is %lf\n",polynomial); system("pause"); … | |
Hi! I'm trying to emplement the job queue. Somehow i can't initialize it: the queue is empty `Inline Code Example Here` //INCLUDES #include <stdio.h> #include <stdlib.h> #include <semaphore.h> #include <pthread.h> //GLOBALS pthread_mutex_t job_queue_mutex = PTHREAD_MUTEX_INITIALIZER; int i; #define N_threads 10 int val=0; //STRUCTURES typedef struct job { int data; struct … | |
long FileSize(FILE* f) { if(f) { long size; long initpos = ftell(f); fseek(f,0,SEEK_END); size = ftell(f); //Get End Position Which fseek(f,initpos,SEEK_SET); //Go Back To Initial Position return size; } return 0; } Only 183 characters in text file but reports 197. Reason for this? | |
Hi everyone! This is the code that I have made, however, when I enter a date for example if I type : 12/12/2012 then the date for tomorrow displays a list of dates. I am unsure how to get it to only display the date of tomorrow. #include <stdio.h> int … | |
How to add two sparse matrices stored in 2d arrays?? | |
hi everyone I'm asked to implement malloc and free as my project in operating system course , but the big problem is that i have searched a lot about it and still have no idea about it , if anyone can tell me what are the main functionalities of the … | |
hi in C if someone says printf(%d,x); is x int and double or just int? I know %d is decimal . Will this be the same for printf(%d,&x);? Also cin>>x.Can x be any arithematic type? Thanks | |
Hi everyone, I want to excess a operate according to a wide range dimension or perhaps tips. Ex: int calc(int a[]); int calc(int a[][]); as well as int calc(int *a); int calc(int **a); *a ought to be &a however i don't realize how to encounter any research of an reference … | |
I am designing my own algorithm to check if 2 codes are similar or identical? How do pre-exsting softwares do this? What logic do they use? Are there different levels of testing for this? please give detailed answers **CLOSED DUE TO DOUBLE POST, SEE** http://www.daniweb.com/software-development/cpp/threads/420816/how-to-check-2-codes-are-similar-or-identical | |
.Write a C program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex,exam Scores (3 quizzes per semester), mid-term score, final score, and total score. after entering them write them to a file called Student.txt | |
Hello I have wrote a c program to solve sudokus, and i would like to know if i can draw the grid and fill it using ncurses library. i just would like to know how to control the lines and borders of boxes in ncurses thank you very much | |
Hey all, I am working on a project with an FPGA but I need serial communication between the FPGA and the desktop since the memory of the FPGA is limited and I need to be able to send longer inputs to the FPGA by using buffers on the desktop. After … | |
iam trying to use only one function to get the value of add and sub. if there is a label i want to ignore it. file.txt ------------------------ label: add $1,$2,$2 sub $1,$2,$2 ----------------------- int main() { char line2[20]; char tem_line2[20]; char *tptr; while(fget...line2) //read one line and store in char … | |
why is the output of the below program is coming out as 'unequal' ??can anyone please explain?? #include<stdio.h> void func(char *); void main() { char *q; char *p; p="hello hii"; func(q); if(p==q) printf("equal"); else printf("unequal"); } void func(char *pi) { pi="hello hii"; } | |
I meant to post this in the C forum and not the C++ forum. Below is the link to a picture of the debug error window [url]http://www.flickr.com/photos/7629837...in/photostream[/url] It's a program that i'm doing and I keep getting this error here's a link to the programming problem. Its' Number 3 [url]http://books.google.com/books?id=bSy...%2B%2B&f=false[/url] … | |
Please refer to the code below.It is used to extract files from a given directory, for further processing. #include <dirent.h> #include <stdio.h> #include <string.h> int main(void) { int i=0; struct dirent *direntry; dir = opendir("E:/muzikk"); if(!dir) { printf("Error: directory did not open!\n"); return 1; } while((direntry=readdir(dir))!=NULL) { printf("%d %s\n",i,direntry->d_name); i++; … | |
Write an ATM machine programme that will prompt a user to enter a password "DEF" and username "ABC" after which it should ask the user what they want to do and depending on what they choose ,perform necessary actions from depositing to check balance...in your programme include writing and reading … | |
Dear All, I have written a program which converts an input decimal number into any number in a base between 2 and 36. Below is my program: #include<stdio.h> #include<stdlib.h> int main() { int newbase,n,i,ascii,ndigit=0,q,r,zero; char newrep[100]; printf("Enter the number to be converted"); scanf("%d",&n); printf("Enter the base between 2 and 36 … | |
Please refer the code below I am trying to read integers from a file (till the end of file). But my problem is that only the last number is printed twice. /* fscanf example */ #include <stdio.h> int main () { int i; FILE * fp; fp = fopen ("/home/my/Desktop/write.txt","r"); … | |
Hi i am a newbie in C programming especially in the socket area. Supposely i am writing a FTP, and want to **_get_** and **_put_** file in the FTP. However, i have encountered a bug/error when client is trying to get(download) file from server. The problem is as follow: First, … | |
Hi, I'm new here, so I'm sory if this theme already exsist. I'm trying to do a database of students in c, and I want to use queue for realizing that. For example: Name: char surname: char id number: char or int subjects: queue User will enter id number and … | |
Hi Guys, I have written the below program to convert binary to octal, it is giving me erroneous results. On entering 1111 as the input number I should get 17 as the output, whereas I am getting 16707000337 as the output. Kindly help me out, below is my program: /*program … | |
I want to delete the first element from a list. this is my list: struct dlist { int liber; //it translates as "free" don't know what this is int nmax; //maximum number of elements DATA *pv; //a pointer with which i can move in list, also DATA is int }; … | |
Hi there everyone, Hoping eveyone is alright! I just got built this simple database program. Things were quite fine not until I reached a point where i couldn't read the records in my little database. I have tried to figure out where I could have gone wrong but I don't … |
The End.