15,552 Topics
| |
for (y = 1; y < num1 + 1; y++) { for(x = 1; x < num2 + 1; x++) { if (y >= 1 && y <= 4 && x >= 1 ) { printf ("%d x %d = %d", y, x, y*x); printf (" || "); } else … | |
Hello everyone! I tried a lot to understand the spacing procedure in pascal triangle.. but it all went to vein!! Does anyone knows about this spacing??? Why are we using this loop: for(x=40-3*y;x>0;--x) printf(" "); need help ASAP!! | |
I just want to know the exact difference between intialising and assigning a variable. Is it possible to initialise a variable multiple times in C prog or is it just initialise once n assign all the other time...can somebody help me out please. | |
I am trying to learn how to write a merge sort function, but I have only gotten so far with the book I am using now: [code] template <class T> void mergeSort(vector<T>& s) { mergeHelper(s.begin(), 0, s.size()); } template <class Itr> void mergeHelper(Itr start, unsigned int low, unsigned int high) … | |
Hi friend! I wanna create my own online sms site. But I stuck with something. That is, i got an open source gateway called [kannel](http://www.kannel.org) But what I want to know is,what are the key ingredients for an online sms service. I mean the stuff i want to create online … | |
I am trying to parallelize the [Guibas Stolfi delaunay triangulation](http://goanna.cs.rmit.edu.au/~gl/research/comp_geom/delaunay/delaunay.html) using openmp. There are two things to parallelize here- the mergesort(),which i did and the divide() where I am stuck. I have tried all possible approaches but in vain. The approach followed(divide n conquer) in divide() is same as that … | |
Hi every one, #include <stdio.h> #include <conio.h> #define SIZE 4 int main(){ char Menu[SIZE] = {'A','B','C','D'}; int i; for(i=0; i<(SIZE); i++){ // print the array elements printf("\t%c",Menu[i]); } getch(); } I want to swap the elements of the array for e.g. if I pass A and D or Menu[0], Menu[3], … | |
I was just experiminting with the following C code and i noticed something interesting.. The first loop runs fine, but from the second loop the variable r1 occupies the kernel address space(ffffffffe) and instead of randomly changing as it is supposed to, all the consecutive loops show r1 as occupying … | |
I'm trying my hand at OpenCV and have run into a problem that Dr. Google hasn't been able to help me out with. According to O'Reilly, the following code should play an AVI file in a window the program creates. [CODE] #include "highgui.h" #include <stdio.h> int main( int argc, char** … | |
*i am trying to copy the value of ar2[10] //in main. has the value 1,2,3,4,5 in ar[10] //(in struct node). empty array so to copy the value iam not sure if i could use a strcpy for ex, strcpy(head->ar, ar2); //here is my code struct node { int ar[10]; //empty … | |
Okay, I know there is a prior article about this, but I used { } with my if statements, and it's still not working... is it because I have multiple if statements consecutively after another? #include <stdio.h> #include <stdlib.h> #include <time.h> int i, n,t, s[51],p=1,a,b,c; int main() { srand(1); for(i=0;i<=51;i++) … | |
Is there any standard function in gcc that is equivalent to getch() so that I can read the input without hitting enter key? | |
I wrote this program... Just gave a try!! i got a problem with searching a string in file.. the **"checkp"** used in the login function, returns a value **"1"**, whereas it must return a value **"0"** Hence my program fails... what i felt is, the file i'm opening, **"web_reg.txt"**, in … | |
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 #include<stdio.h> #include<conio.h> void main() { struct student { int id; char name[20]; char sex; int mid; int final; int total=mid+final }; int i struct … | |
#include<stdio.h> #include<conio.h> void main() { struct student { int id; char name[20]; char sex; int mid; int final; int total=mid+final }; int i struct student b [19]; for(i=0;i<20;i++); { printf("student %d enter your details\n\n",i+1); printf("enter your id"); scanf("%d",&b.id); printf("enter your name\n"); fflush(stdin); scanf("%s",&b.name); printf("enter your sex\n"); fflush(stdin); scanf("%c",&b.sex"); printf("enter mid … | |
iam trying to store all the data in to a struct so i can change it later. //this data is in file abc 1 11 22 def 2 33 ghi 0 22 11 33 asd 2 i was planing on making a array of structs. so 1st line will have … | |
trying to copy pointer in array. lets say *pointer has the value "COMPUTER". and i want to store in array[o]; note: i want to use strcat to do this and i do not want to do some thing like "array[0]" char test[10]; char *point; //has the value "COMPUTER" for(int i … | |
include<stdio.h> struct address{ char city[20],country[20],state[20]; }; struct customer{ int acount; char name[20]; float bal; struct address add; }; void display(struct customer * ,int); void main() { int i,size; printf("enter the number of customers"); scanf("%d",&size); struct customer cus[size]; struct customer * c[size]; for(i=0;i<size;i++) { printf("!"); scanf("%s",&cus[i].name); printf("!"); scanf("%d",&cus[i].acount); printf("!"); scanf("%f",&cus[i].bal); printf("!"); … | |
Hi! I'm currently making a HTTP protocol bot, it works somewhat fine with a fixed char array, but once there's a website that exeeds 8k, then it cuts off. If it's less, I get weird nonsenscial symbols... Is there a way to know the length before assiging the data to … | |
i have this c++ code and i wondered how ot would be in c #include <vector> // for vector #include <sstream> // for stringstream #include <iostream> #include <string> using namespace std; int main() { stringstream ss; string input, temp; vector<string> comand; cout << ">: "; getline(cin, input); ss << input; … | |
I am trying to use the glib HashTable implementation for my code and facing some issues in memory allocations. The code I've written is: GHashTable *g_hash_table; g_hash_table = g_hash_table_new (g_direct_hash, g_direct_equal); gint *port, *src_value, *value; guint32 *dst_key, *key; . . . while(1) { key = g_malloc (sizeof *key); dst_key = … | |
Hello, I am having trouble with my code. it does not seem to be comparing the two hands correctly I would really appreciate it if someone could take a look at it and tell me where i am going wrong. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define TOTAL_CARD_DECK … | |
#include <stdio.h> int main() { int a[0]; int b=2; printf("%X",a); return 0; } Where ever can we use 'a[0]' means array with index zero.. | |
**The program below wont run due to the following errors :** *MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup fatal error LNK1120: 1 unresolved externals* **Please help me to solve these errors.** #include<stdio.h> #include<conio.h> #include<Windows.h> int Choice=1; char opt; int ch=0; void Main() { while (ch!=4) … | |
I got an assignment which I don't even know how to start, I have a path to a driver & its name (Argv) and I need to create a code that will install this driver automatically. If anyone even has an idea how to make this code generic I would … | |
I have an assignment question . We need to simulate FCFS scheduling algorithm using C on linux OS. This is what I need to do Write a program to simulate **FCFS scheduling algorithm** using pipes for inter process communication. 1. Let the parent program be the scheduler. 2. It takes … | |
int main() { float stud1[2], stud2[2], total1, total2, ave1, ave2; int x; char letter1, letter2,opt; do { system ("cls"); printf ("Enter the test scores for Student 1\n"); printf ("Test 1: "); scanf("%f", &stud1[0]); //Error checking, when the user inputs a value less than 0 or more than 100 if (stud1[0] … | |
Hi, I need to do this program in my university and I was wondering how can I do it so that when there are no exits available, the program just says "type q to quite", and skips the 'Type the first letter of the next step or direction you want … | |
What I am supposed to do is create a C program which implements a "dumb" Sliding Window Protocol Implementing Client Server Program. First the client and server establish a connection between themselves and then the client sends "RST" to the server. The server inturn sends its window size (10) to … | |
Hi All, I have written a program to input a decimal string and convert it to character string. Below is my program: /*this program converts the decimal representation of an input string to character representation*/ #include<math.h> #include<stdio.h> #include<stdlib.h> char int2str(int n); int main() { int dec[100]={0},i,j,decindex,ndec=0,nchar; char character[100]={'\0'}; printf("Enter the … |
The End.