15,551 Topics
| |
hello i am trying to broadcast some values, but i dont see the function of broadcast happening....the code i had written to broadcast is #include <stdio.h> #include <stdlib.h> #include <mpi.h> int main(int argc, char *argv[]) { int rank, size, i, n, num, send; n=atoi(argv[1]); MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD,&size); MPI_Comm_rank(MPI_COMM_WORLD,&rank); if(rank==0) { … | |
Working on an assignment for class. I was able to get the sorts created buy for some reason im having a problem with reducing redundant code within my int main() function [code] /* 1.) create 10, 100, 1000, and 10000 randomly generated elements 2.) Perform The Following Sorts on the … | |
Hello all, I recently installed MinGW on my XP Pro box (SP 3). When I click on the shell icon, the resulting behavior of the MinGW shell console window is incorrect. Initially, the console opens up as it should, complete with frame and scroll bars, but after about 5 seconds, … | |
Ok, to the point as suggested. Second semester CS assignment to write program that reads maze info in from txt file to create maze a solves the maze recusively. I've got a dynamically allocated 2D array wtih each cell containing number that detemines the walls by bit values and it … | |
well i am trying to do a program, where the process 0 should start the initialization of sending messages to a random process other than itself, then the random process selected should receive the message and send to another random process. This should happen until the requested number of messages … | |
| This is my first post on daniweb :) and i am a beginner in C programming and i don't know so good english :) sorry! This is my program My problem consist of I run the program and i can't get to the [B]scanf("%c",&q);[/B] [I]/* Row 21 after printf. */[/I], … |
Hello, I need help to combine a c-program using curl(to retrieve txt files from internet) and another c-program using popen. currently the popen is using the command ls -l (to list the current folder in terminal). I have 2 files, the first one is curl program, which have to retrieve … | |
[CODE]#include<stdio.h> #include<conio.h> //header file declaring void main() { int a,i; clrscr(); printf("\n Enter the Number:"); //get value scanf("%d",&a); if(a%2==0) { printf("\n Not prime number"); } else { for(i=3; i<a; i=i+2) { if(a%i==0) { printf("\n Not a prime"); break; } } printf("\n Prime number"); } getch(); } [/CODE] | |
I've already write a program which allow you to enter name, address and write in the file name,length of name, address ,length of address. File is called "input.dat" Now i need to write another program that reads the file "input.dat" (the one above), displays the name, the size of the … | |
can anyone please tell me whats actually happening in this code. Seems to be as if incremented pointer is pointing to the next bit of same int. Answer is 2,0 Thanks in advance [code=c] #include<stdio.h> #include<conio.h> void main() { int arr[3]={2,3,4}; char *p; p=arr; p(char*)((int *)(p)); printf("%d",*p); p=(int*)(p+1); printf("%d",*p); getch(); … | |
My research group is trying to implement a hash table to reduce the effects of a very costly step in our calculations. Basically, it can take more than an hour to go from A to B, and B is something ridiculously simple, like a number between 1 and 100. A … | |
Hi All, I wanna to search a pattern in a txt file called A which is a 2D matrix from another file called B. The requirment is that I need to output the number of matched pattern in file B. But I encounted difficulty of counting the number. Basically I … | |
hello. i make a program for bus ticket reservation and i want to put a seat number in there. so if want to loop the program, and if i pick the same seat number, the program will tell me the seat is taken. is it possible to save information before … | |
i have to find proper divisors of a positive integer.for instance,the proper divisor of 15 are 1,3,5. input 15 output 1 3 5 like that. Thank you for your helps. | |
hi. this is my program for bus ticket detail. at the bottom of my program, i want user to input yes or no for loop this program. but before i can input anything, it already told me that 'Please input the correct answer'. it is like i already input something. … | |
Can any body tell me the difference between file descriptor and filepointer in C on linux? and when to use what? | |
[CODE]#include<stdio.h> #include<conio.h> struct bnode{ struct bnode *child[5]; int count; int value[5]; }; typedef struct bnode node; node * root=NULL; void insert(int val); int put(int,node*,int *,node**); void fillnode(int ,node *,node*,int); int search(int,node *,int *); void insert(int val) { int i,flag; node * c,*n; flag=put(val,root,&i,&c); if(flag) { n=(node*)malloc(sizeof(node)); n->count=1;//setting count 1 n->value[1]=i;//setting … | |
Ok so, I'm working on a program that is suppose to solve a function: (1+ (x^2) / sqrt(3x+6)) / (x^2 - 5x) As you tell by the function the denominator cannot be = to 0. So here's my code that I'm having trouble with. [CODE] #include <stdio.h> #include <math.h> int … | |
hello. i have a problem in selecting destination and time. when i select any number in destination the program always tell me that i choose number 1 (taiping). and the time it always show 1030 even i input number that is not 1. please tell me where i'm wrong here. … | |
hey guys lol i spent 5 hrs thinking about building this asterick pattern and i am still getting troubled by the spacing for the 3rd pattern , anyone can help me to reduce 1 spacing so the 3rd pattern isn't out of place?XD [CODE]#include <stdio.h> int main() { int c,c_2,c_3,c_4,c_5,c_6,c_7,c_8; … | |
Hello everyone. I'm trying to code the cd shell command in c. I used chdir function to code it but the problem is that when I execute the program on the terminal it doesn't change the directory. I kept a series printfs and conditions to test if it changes, though … | |
hi guys, iam a beginner in c and i have got a project to make a program to keep the track of stock and cash of a shop i had done my work but i want to add purchase and iam unable to keep the work in history as a … | |
Building a phonebook program for school--very much a work in progress. I still need to write a sort function, tweak my delete function, etc. But actually what I'm hoping you folks could answer is hopefully simpler--for some reason I seem to have a while loop that is executing twice, and … | |
This program must calculate permutations but it gives me a result with smiley , Can someone help me, Thanks!! [CODE]#include <conio.h> #include <stdio.h> #include <math.h> const n = 10,num=4; int i,a[n]; void tipareste(){ int i; for(i=0;i<num;i++) { printf(" %d \n", a[i]); } } void permuta(int k) { int i,x; if(k==1) … | |
When you include a header file like sys/stat.h you can use the functions like stat. But where is the function body? I didnt write the body, yet it still does something. | |
is this a valid statement in in c: &main, where main is int main()? If so why? | |
Hello everyone I am trying to apply [URL="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes"]Sieve of Eratosthenes[/URL] in program, but its not working. Here is my code:-- [CODE] #include<stdio.h> long long arr[10000]={0}; int main() { long long i,j,num,inc=2,m=0; num=5000; for(i=0;i<num;i++)arr[i]=i; for(i=2;i<=num/2;i++){ if(arr[i]>0) { for(j=inc*i;arr[j]<=num;j=j+i) arr[j]=-1; inc++; } } for(i=0;i<num;i++)printf("%lld ",arr[i]); printf("\n"); return 0; } [/CODE] This code … | |
how do you promt the program from positive integars terminatd by -1 .. and then ask for smallest of these integars. I did everything except when I add (!= EOF) .. It shows the same prompt multiple times should I still keep the code or is there a specific error? … | |
HI, I'm writing a code for the very first time, and I'm completely stuck. Some guidance would be great. I'm writing a C program that reads integars from file "integars.dat". The program should show how many numbers you have entered, how many among them were even, and how many were … | |
Hi, I have stupid question. I have array like this. [CODE]float *numbers[] = {5; 6; 9; 10};[/CODE] I need to use for example float = 5 for arrays numbers[0], numbers[1], numbers[2], numbers[3]. Then array float = 6 for numbers[4] and numbers[5] etc. Hope you undestand. Is there some syntax like … |
The End.