15,552 Topics
| |
[CODE]# include<stdio.h> # include<string.h> int main(int argc, char **argv){ char phone[16]; int num = 0; int count = 0; printf("Enter a phone number: "); count = scanf ( "%s%n", phone, num ); memmove(phone + 3, phone + 2, 10); memset(phone + 3, '-', 1); memmove(phone + 7, phone + 6, … | |
I am confused as to where Am I supposed to assigned a variable . my code goes like this [CODE]char text[]= "FRUITS"; printf("Enter between apple,orange or mango"); gets(text);[/CODE] I want to assign a variable "User_select" to that printf part . | |
Hi, I am trying to print the values in enum. Here is the code: [CODE] #include<stdio.h> int main(int argc , char* argv[]) { char played[] = "This old man, he played "; int i=0; enum days{one,two,three,four,five,six,seven,eight,nine,ten}; enum days d; for(i=0;i<10;i++) { printf("%s %s\n ",played,d); } return 0; } [/CODE] Can … | |
how do i determine the winner in a game rock paper scissor ? i have 10 rounds and the one who has 7wins shall be declared as the winner but how am i supposed to do that ? great help is highly appeciated :) | |
Hi there. I'm writing a simple system to order certain data. Now this is the deal: I have a bunch of files with the following filename structures (stored as strings): 0000[i]_FILENAME.EXT i represents a random number. Now I want to scan whether the file has that structure, and if it … | |
[CODE]void main() { char a=250; int expr=a+!a+~a+ ++a; printf("%d",a); getch(); }[/CODE] what is output and plz explain it..:):) | |
Hi guys, A good day to you all! I am trying to bulid a simple data base but two errors at compile time apparently are holding me back from running my program. I have tried to figure them out but my efforts are are proving worthless and that's why am … | |
here why should we have to write [B]c=1[/B] ?? i couldn't understand the logic of writing c=1 :s... please just explain the logic [CODE]void main(void) { int a,b,c=1; a=5; for ( b=a; b>0; b--) { c*=b; } printf ("The Factorial of %d is %d\n",a,c); getch(); }[/CODE] | |
[B]Hi, i just want to know that from where i can download "VISUAL STUDIO 2005" free...[/B] | |
As far as I can tell, this is safe. It prints "Should Get Here" and nothing else, as expected and desired. In real life, CantGetHere is a function that actually IS called and does some arithmetic. To avoid a seg fault in line 14, I have a NULL pointer check … | |
[code = c][/code] I am trying to write a program that takes a 10 digit phone number and inserts hyphens between the 3rd and 4th digit and the 6th and 7th digit eg. Enter phone number: 5553459875 Your number is 555-345-9876 I've decided that reading the number as an integer … | |
[CODE]union { int a; char b; char c[10]; }u1; void main() { int l=sizeof(u1); printf("%d",l); getch(); } [/CODE] This gives the output as 10, shouldnt it be 2 + 1 + 10 == 13 ??? Can some1 explain ? | |
Hi Guys, Basically I have an application that reads in a .hex file and I want to be able to then sort the hex values out line by line into a 2D Array ready for further processes. Example of a .hex file [CODE]:10010000214601360121470136007EFE09D2190140 :100110002146017EB7C20001FF5F16002148011988 :10012000194E79234623965778239EDA3F01B2CAA7 :100130003F0156702B5E712B722B732146013421C7 :00000001FF[/CODE] Below code is … | |
| |
Hi, I'm having trouble understanding pointers and arrays. [CODE] course[] = "Numerical Methods"; printf("%c %s\n", course[6], course); printf("%c %s\n", course[6], &course[0]); [/CODE] I don't understand how the second print statement prints the same thing as the first. How does &course[0] print out the entire array? I thought it was just … | |
[code=c] #include <stdio.h> #include <string.h> #define MAX_input_size 100 struct RoutingInfo{ /* Structure to hold the IP entrys */ unsigned int IPDestinationNetwork; unsigned int subnetMask; int prefix; unsigned int gateway; char* interface; } entry[MAX_input_size]; int computePrefix (unsigned long decimSM){ /* computes the prefix of the Subnet Mask */ int prefix = … | |
[CODE]while ((userinput[0]==userinput[1]||userinput[0]==userinput[2]||userinput[0]==userinput[3]||userinput[0]==userinput[4])&&(userinput[2]==userinput[1]||userinput[2]==userinput[2]||userinput[2]==userinput[3]||userinput[1]==userinput[3])) [/CODE] If the user types ABCC, the program must show double letter....but sometimes the code up there doesn't work correctly....suggestions or fix? | |
I have tried to get this program to work with no luck. How do you properly use the nested selection structure? (sorry for the lack of braces, I tried getting rid of some for less confusion. Didn't think it would work but thought I might as well try :D). I'm … | |
How can we calculate whether a number is a power of 2 or not in a single statement without using a loop? All the ones that I can think of use loops or don't satisfy the condition. for eg. The use of XOR doesn't work as it gives incorrect input. … | |
The task at hand is to write a program that accepts arguments from the command line and convert them into USD. For example, take command line argument Currency EU 350, and convert in into USD. Now, please bear with me -- I may be phrasing this incorrectly, but how do … | |
I want to write a program where, 1. string1 is declared as char s1[80]. string2 is declared as s2[40] 2. Function needs to check that the sum of both strings is less than 80 characters prior to appending them 3. If the sum is greater than 80 characters, return a … | |
Hi. I wrote a calculator that calculates the given expression (eg, 2 +3 +4-3-1), it works only if you type expression and press ctrl-d, what i have to do to display the result after pressing enter Here's the code: [code] #include <stdio.h> int main() { printf("give expression \n"); char expression; … | |
suppose i want to read excel contents of 123 as 'one hundred twenty three'. please provide suggestion. srinivas | |
It works for the first time but when it loop nothing is stored wondering whats wrong could someone help me out please? [CODE]void main () { char buffer[256] = {0}; char password[] = "test"; char c,i=0; int pos = 0; do { buffer[0]='\0'; printf("%s", "Enter password: "); do { c … | |
I have a file pointer which was assigned in main. In the main, I just open a file to write stuff to it. I want to pass the file pointer to several functions so that they can write to the file. In the fucntion declaration I just add: somefunc(FILE *file) … | |
I am making a video recording program that takes input from a v4l2 webcam and outputs to an avi file. Using gstreamer in c, I have got most of the program to work, and the file is created. I can get the pipeline to display the video to the screen, … | |
I am taking a step backwards in to C from C#. I am studying C# at University but feel I may be rather restricted as to what I can do later on. For that reason I would like to learn C (also to get a good idea about the real … | |
I'm suppose to make a code that is suppose to check errors on inputted letters but I can't seem to get it right cause when I input something either wrong or right it still prints "ERROR" [CODE]void check(char a, char b, char c, char d,char e,char f, char g, char … | |
In programming terms, Is there any difference between Generate Anagrams, and Generate Permutations of a string ???? | |
Hello, [URL="http://www.daniweb.com/software-development/java/threads/223488"]http://www.daniweb.com/software-development/java/threads/223488[/URL] I need C code for a problem in given link above. I tried to convert it to C code but couldn't do it, i'm kinda beginner. I guess it's easy problem for pro programmers so i really appreciate if you can help me out. |
The End.