15,551 Topics

Member Avatar for
Member Avatar for newcuser

I am trying to input a text file with twenty unsorted names in it into an array and then perform a bubblesort and output to a new file. The filename for the txt file is names.txt Here is what I have so far....not much...I would appreciate some help the right …

Member Avatar for newcuser
0
2K
Member Avatar for miles.85

I will start a new project. But I have some simple questions about it : 1) Is the C faster than Java on processes which has no graphic user interfaces (like softwares which are working just from command line) ? 2)Because if the C is faster than Java, I want …

Member Avatar for miles.85
0
215
Member Avatar for OzY360

I don't believe there is a Forum dedicated to Cryptography so I will post in the C forum since the program I've used to decode a base 64 encoded file was written in C. I have been given a base64 encoded file and I have managed to remove the base64 …

Member Avatar for OzY360
0
114
Member Avatar for damndamn

please help.. a small airline wants you to create an automated reservation system.the system has to assign seats on each flight of the airline's only plane(capacity:10 seats).your program should display the ff. alternative choices: PLEASE TYPE 1 FOR "FIRST CLASS" \n PLEASE TYPE 2 FOR "ECONOMY".\n\n\n if the person types …

Member Avatar for peter_budo
-3
183
Member Avatar for COKEDUDE

How would I make all letters be an invalid input? I want all letters, numbers greater than 20, and numbers less than or equal to 0 to be invalid inputs. I used an or cause I want any case to be an invalid input. Any help would be greatly appreciated. …

Member Avatar for sumitunya
0
2K
Member Avatar for abhimanipal

Hello People, I cannot understand how this expression gets evaluated .. 1+~0 From what I know ~ has higher priority . So the expression becomes 1+(~0)= 2 But the answer that I got was 0. I know it is some thing to do with the fact that ~ is right …

Member Avatar for abhimanipal
0
82
Member Avatar for Takarakujin

Basically I am totally confused on how to pass a char, which is given by the user, and then store it and pass it to another function by reference.

Member Avatar for Ancient Dragon
0
100
Member Avatar for johndoe444

The following code gets segmentation fault: [CODE] void dfs_visit(graph g, int u) { // printf("u: %d\n",u); /* g.vertices[u].color = GRAY; g.vertices[u].d = time++; printf("before visit for loop\n"); for (int i = 0;i < g.number_vertices;i++) { if (i != u) { if (g.vertices[i].color == WHITE) { g.vertices[i].p = u; // dfs_visit(g, …

Member Avatar for johndoe444
0
134
Member Avatar for Takarakujin

[CODE] int main() { char c1, c2; printf("Enter a character: "); scanf("%c", &c1); printf("Enter another character: "); scanf("%c", &c2); system("pause"); return; } [/CODE] Thats what my code looks like, the problem is the code skips the part where it lets you input c2. I dont understand why its doing this. …

Member Avatar for gerard4143
0
133
Member Avatar for sonai4u

Hi, I need one of my assignments to be done in C or C+. Need someone who can do the assignment for it. Need it urgently..need the assignment done by sunday. Will pay money for doing the assignment. Please email me immediately <<Email Snipped>> thanks Raj

Member Avatar for Ancient Dragon
-7
495
Member Avatar for kendaop

Hello. Can someone please tell me what happens when you cast a large number to a char? For example: [CODE=C] char string[8]; int num = 2040; string[0] = (char) num; [/CODE] I'm working my way through a larger program to figure out what it does, but I'm not sure how …

Member Avatar for Dave Sinkula
0
5K
Member Avatar for bsudhir6

I wrote a program for counting and printing characters in a data link layer frames i've succeeded in getting output for the first frame but for the other frames it showed not valid please help in the code If i give an input as 6sudhi4div then the integer in the …

Member Avatar for abhimanipal
1
186
Member Avatar for goldenmean

Hello, This might not appear like a programming question, but inherently deals with code. I have a following piece of test-code, which has obvious errors like array index out of bounds, memory leak:- [CODE] #include "stdio.h" #include "stdlib.h" main() { int i; char *ptr; ptr = (char*)malloc(5); for(i=0;i<10;i++) { ptr[i]=(char)i; …

Member Avatar for Dave Sinkula
0
284
Member Avatar for harmony217

Hello, Can we download files from WWW using a C code? I could find codes in C#, php, and Java and I wonder if it can be done in C. Thanks.

Member Avatar for Ancient Dragon
0
45
Member Avatar for Iam3R

here i have two bubble sort versions. [CODE] void bsort() { int i,j,jc=0,ic=0,temp,swap=1; //for(i=0;i<NOE & swap;i++){ this one or for(i=0;i<NOE-1 & swap;i++){ \\ this swap=0,ic++; for(j=0;j<NOE-1-i;j++){ jc++; if(a[j]>a[j+1]){ temp = a[j]; a[j] = a[j+1]; a[j+1] = temp; swap = 1; } } } printf("jc=%d ic=%d\n",jc,ic); } [/CODE] i checked it …

Member Avatar for hiraksarkardg
0
109
Member Avatar for moshe12007

i programming in c language and i need to using parallel port the compiler that i using : "microsoft visual C++" int the old compiler i using this command : inport(0x378) but now in vc that not work please help me...

Member Avatar for moshe12007
-1
58
Member Avatar for DoEds

I'm new to structures, our instructor haven't discussed it yet... Im trying to make a program that will ask the user 5 "fruits". Ex. The user input: Mango Apple Mango Grapes Grapes Output: Fruits entered: 2 Mango 1 Apple 2 Grapes I've trying to see some tutorials but i can't …

Member Avatar for WaltP
0
109
Member Avatar for xavier666

Let's say we want to free the total memory used by a linked list in a program, I generally do it like this [CODE]typedef struct linked_list { int some_data; struct linked_list *link; }NODE; int free_memory(NODE * head) { NODE * temp = NULL; if(head == NULL) return 0; // FAILURE …

Member Avatar for Ancient Dragon
0
96
Member Avatar for abhimanipal

Hello People... I found this sample code online [code=c ] int main(int argc, char* argv[]) { struct bitfield { signed int a:3; unsigned int b:13; unsigned int c:1; }; struct bitfield bit1={2,14,1}; printf("%d",sizeof(bit1)); return 1; } [/code] I compiled this code on linux with gcc compiler and the output I …

Member Avatar for abhimanipal
1
92
Member Avatar for free2rhyme2k

Hi there, I'm putting together a simple client and server to receive packets containing video data. Here is the part where data is read. The data packets contain typically around 1000 - 1500 bytes of data. [CODE] int getNoPackets = 0; int packetsWrittenToFile = 0; for (i=0; i<NPACK; i++) { …

Member Avatar for free2rhyme2k
0
2K
Member Avatar for johndoe444

hi, with this code fragment: [CODE] #include <stdio.h> void print_bit_string(char x) { int s = 128; for (int i = 0;i < 8;i++) { printf("%d",x & s? 1: 0); s >>= 1; } printf("\n"); } char abs(char x) { if (x < 0) { x = -x; } return x; …

Member Avatar for Dave Sinkula
0
92
Member Avatar for ~s.o.s~

Hello here i am posting the non recursive or no recursion implementation of outputting [B]Permutations of a string [/B]as compared to the recursive implementations previously posted. Any feedback, constructive criticism or comments are most welcome.

Member Avatar for samir1
0
2K
Member Avatar for tquiva

Could somebody please help me with this program. This is my first time working with an EOF loop. This program simply adds up all the input numbers. My task is to have the last wanted input terminated by an EOF. However, when I run my program, my loop is infinite. …

Member Avatar for biswajit_cs07
0
110
Member Avatar for yila

i have a problem with a program which gets a matrix[3][3] (with values 1-20.) i want to print the index of cells whose surrounding cells all have lower values. in a matrix 0 0 0 0 1 0 0 0 0 it supposed to print only [1][1]. can someone look …

Member Avatar for WaltP
0
174
Member Avatar for hwlibra083

Does anyone know how to do this: I need to read data from a .txt file into a multidimensional array that is dynamically allocated from memory. How would one do that? Thanks to whoever can help me!

Member Avatar for hwlibra083
0
1K
Member Avatar for techno_weenie

Hello i'm getting a segmentation fault in my is_validport() function and could somebody people point out what i'm doing wrong please? [CODE]#include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <ctype.h> #include <string.h> /* Function definitions. */ //char *is_uid(char *s); char *is_destportseq(char *s); char *is_destport(char *s); char *is_validport(char *s); char *trimwhitespacestartandend(char *str); …

Member Avatar for techno_weenie
0
195
Member Avatar for knshn

Hi, I want to take a command with its options as input and execute it with one of the exec() functions. My approach is to take input first and put it in an array by dividing with string tokenizer. Then I call execvp() which takes the array including the command …

Member Avatar for knshn
0
395
Member Avatar for VernonDozier

I'm relearning (OK, "learning" would be a better term since I never really understood it the first time) piping. My end goal is to execute some shell commands like "ls", get the results into another variable, and do some stuff with it. I imagine I'll end up using commands like …

Member Avatar for VernonDozier
0
139
Member Avatar for johndoe444

For this content of the file/stdin: [CODE] a 3 W 10 A 100 , 10 k 7 . 3 I 13 [/CODE] I have written the following code [CODE] while (k-- > 0) { scanf(" %c %d",&c, &p); printf("c: %d p: %d\n",c,p); } [/CODE] if I change the format string …

Member Avatar for WaltP
0
2K
Member Avatar for COKEDUDE

When you have a function and need to scan for 2 different numbers, should the scanf be in the function or in the main() and why?

Member Avatar for WaltP
0
149

The End.