15,551 Topics

Member Avatar for
Member Avatar for srisrisri

Hello Can anyone tell me the way to reverse a string in C and only in """"C"""? How to get a string through one by one characters of the same? And if I use the following I get errors String name="hai"; len=strlen(name); for(i=0;i<len;i++) { scanf("%c",name[i]); } how to get name …

Member Avatar for minhajakhter
0
312
Member Avatar for yassop

Hi all. I have a problem with my calculator. #include <stdio.h> int a, b; /* value entered by user */ char c, choice; int main() { printf("\nThis program is a calculator.\n"); printf("Enter your calculation: "); scanf("%d%c%d", &a,&c,&b); if (c=='+') printf("The answer is %d", a+b); if (c=='-') printf("The answer is %d", …

Member Avatar for yassop
0
236
Member Avatar for iamsmooth

I'm fairly new to C. I've tried googling but haven't found anything. Can anyone direct me to some relevant functions or readings or whatever that might help with this problem? Basically I need to be able to give a directory as an argument and it needs to be able to …

Member Avatar for griswolf
0
168
Member Avatar for Paritosh Das

[CODE]#include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> void main() { int gd=DETECT,gm,year,month,day,cy,cm,cd,i,j,maxx,maxy; int y,m,d; int midx, midy; int stangle = 0, endangle = 360; int xradius = 100, yradius = 50,xradius1 = 2, yradius1 = 2; int radius = 50; clrscr(); initgraph(&gd,&gm,"d:\\tc\\bgi"); maxx=getmaxx(); maxy=getmaxy(); for(i=0;i<10;i++) { setcolor(4); rectangle(i,i,maxx-i,maxy-i); rectangle(9,11+i,629,45-i); } for(i=0;i<315;i++) { delay(3); …

Member Avatar for jonsca
-2
371
Member Avatar for Jcastillo2010

(Linux)I am trying to use this code: /* *Converts pounds to kilograms. */ #include <studio.h> /* printf, scanf,definitions*/ #define KG_PER_POUND .4536 /*conversion constant */ int main(void) { double pounds, /* input - weight in pounds. */ kg; /*output - weight in kilograms */ /* Get the weight in pounds. */ …

Member Avatar for Trentacle
0
171
Member Avatar for mackemforever

I've just been trying to put together a small piece of code to display the Fibonacci series up to the nth term, where n is defined by the user. I have got it working in a way, it is displaying the series up the the nth term where n is …

Member Avatar for mackemforever
0
122
Member Avatar for ben25x

I have searched and deleted on this code, but I am still stumped on where the "unresolved external" it's complaining about is. Here is the code:[CODE]#include <windows.h> #include <stdio.h> #include <string.h> #include <tchar.h> #include "resource.h" #define GETITEM(item) GetDlgItem(hWndDlg, item) void convert (HWND hWndDlg) { wchar_t ConvertTime[9], ETime[8], UKTime[8], HKTime[8], Hour[8], …

Member Avatar for Banfa
0
244
Member Avatar for ckid

HI friends!! I am very new to this type of groups, and this is my first post to this group, before asking u all a help I am just posting this code to u all, , please respond for this code Huffman algorithm is one used for image compression and …

Member Avatar for nilu28
0
3K
Member Avatar for pinsickle

I should remember this but I am rusty. I'm passing a char* [] to a function which will hold data that I have extracted using strtok. I've tested the output and it is doing what it is suppose to, at least it is inside of the function. As soon as …

Member Avatar for pinsickle
0
200
Member Avatar for Butterflieq

Hi everyone, I'm taking a C programming class and in addition to being unfamiliar with all of the syntax, I'm still learning my way around a new compiler. I'm currently writing a program that gets a user to input 3 numbers, then it will display the lowest to highest. My …

Member Avatar for gerard4143
0
189
Member Avatar for Spider05

I have been working on a HW assignment for a while and I cant figure out how to print out a 'user' selected column out of an array. I can print the rows, but I need to know how to print specific columns dictated by user input. My code is …

Member Avatar for gerard4143
0
191
Member Avatar for Asheem

[CODE]#include<stdio.h> #include<stdlib.h> #include<time.h> #include<stdbool.h> int roll(void) { int num = (rand()%6)+1; return num; } /* void player(void) { int i=0; int sum=0; int dice; char turn; while(i!=6) { printf("Player 1- roll or hold?\n"); turn = getchar(); while(getchar()!='\n'); if(turn=='r') { dice = roll(); if(dice!=1) { sum+=dice; printf("Rolled = %i Your turn …

Member Avatar for gerard4143
0
2K
Member Avatar for anirudhruia

[code] #include<stdio.h> int main() { int n,i,j; char p[10][10]; printf("please enter 10 words"); for(i=0;i<10;i++) { for(j=0;j<10;j++) { gets(p[i][j]) ; } printf("\n"); } for(i=0;i<10;i++) { for(j=0;j<10;j++) { printf("%c",p[i][j]); } printf("\n"); } return 0;} [/code] I actualy want to read 10 string from keyboard and print them but not gettin the output …

Member Avatar for vinayakgarg
0
97
Member Avatar for anirudhruia

How to access structure variables in nested structures [CODE]#include<stdio.h> typedef struct contact { char name[1][20]; struct number { double num; }no; }; [/CODE] Now how to access num ,can anyboddy explain me?

Member Avatar for anirudhruia
0
99
Member Avatar for Madmark88

According to entered number (b), please find the “a” numbers corresponds equation b = a3 * a2. My codes. Whats the mistake ? thanks for helping. [CODE]#include"stdio.h" #include"conio.h" #include"math.h" int main(void) { int a,b = 0; printf("Please enter a number"); scanf("%d",&b); for(int a = 0;a<1000;a++) { if(b==(a*a*a)-(a*a)) { printf("%d",a); } …

Member Avatar for Trentacle
0
155
Member Avatar for ben25x

i have searched everywhere and i cannot find a simple c example for creating a simple click button, where if the user clicks on it, the program prints something to the screen, or something. any help would be very appreciated.

Member Avatar for Ancient Dragon
0
2K
Member Avatar for kohoko

i want to get a random value from the set of values like{1,2,5} how can i do that is that possible i m not that familiar with using random function so plz xplain a bit how to use it if it can be used in this case

Member Avatar for kohoko
0
194
Member Avatar for cufisa

Hello there everyone. I am having a bit of trouble with my C programming. I do not know anything about C programming and this is my first semester and already my professor is putting pressure on me. Anyone that can help would be appreciated. So I am supposed to create …

Member Avatar for cufisa
0
1K
Member Avatar for JDevelop

Hello there, I've just started on C and what I'm trying to do is copying one string to another (which has not been initialized before) without using any string.h functions. Here's my code. [CODE] #include <stdio.h> #include <stdlib.h> void copyString(char*,char**); int main(){ char* string1="Hello there"; char** string2; printf("string1: %s\n",string1); printf("Copying …

Member Avatar for JDevelop
0
284
Member Avatar for Amaina

I'm a newbie to C. Just wondering if i can create input forms in C. Can i also work with C and MySQL?? as in can i build a system using C and MySQL I guess what i'm asking is what are the effective uses of C as a programming …

Member Avatar for gerard4143
0
126
Member Avatar for fab2

[ICODE]Hi, I wrote a program which seemed very simple, a switch case nested in a while cicle. The compiler is not giving any error message, and yet when it's running, it starts an endless serie of loops and I do not understand, why.Here the code [/ICODE] [CODE]#include<stdio.h> int main () …

Member Avatar for ravenous
0
92
Member Avatar for illuminatus89

Is there any way by which I can initialize all the elements of an array(already declared) in one statement?? That is, without using loops

Member Avatar for benwilliams
0
246
Member Avatar for ElegantElephant

For example, I have a string containing "184553", how do I go about extracting the 3rd character "4" from string string and assigning it to another variable? I have tried the following code but it does not work, the system crashes: [CODE] char string[6] = "184553"; printf("%s",string[2]); // Expecting it …

Member Avatar for Ancient Dragon
0
8K
Member Avatar for ben25x

I am quite stumped on something in C. I found this code on the Internet, and it only gives me one error; however, I cannot seem to fix it. The variable in the function the compiler's complaining about is: [CODE]char ConvertTime[8][/CODE] and the function itself is a windows one: [CODE]GetWindowTextW(GETITEM(IDC_CONVERT_TIME), …

Member Avatar for ben25x
0
340
Member Avatar for gf_123

hi I want to write cellular automata lee algorithm (I call it wave method) which searches for the shortest path between 2 points.In lee algorithm the user specifies the weight one for all grid points and the algorithm will find thepath with the lowest number of grid points(it means the …

Member Avatar for hkdani
0
141
Member Avatar for ram619

This code is runnig perfectly for values perfectly divisible by 2, that is 2,4,8 But the i is not incrementing when values are given such as 7,5 could u plz tell me the error Thanks [code=c]#include<stdio.h> #include<conio.h> int fun(int); int main() { int num; float mod,prime,m; printf("enter the num"); scanf("%d",&num); …

Member Avatar for ram619
0
101
Member Avatar for Madmark88

i have recently started to learn c programming and im trying to improve my skill.i have some question about perfect numbers i searched forum but results were about C++. question is this code finds perfect numbers between 1 to 1000000. but its not working after 8128 which is perfect number. …

Member Avatar for Madmark88
0
97
Member Avatar for andylbh

Hi all, I've just started learning server and client communication using socket. What I'm doing here is like a Search Engine. Server stores data (from a textfile) , then client search and check it exists or not. Everything works fine, but I can't seem to loop for multiple search. (Meaning …

Member Avatar for kings_mitra
0
104
Member Avatar for b1izzard

Binary search tree for strings. I tried my best to trace out the error but in vain Need help. [CODE] #include<stdio.h> #include<stdlib.h> #include<string.h> struct bstree { char keyword[25]; struct bstree *lnode,*rnode; }*root; void insert(struct bstree *new,struct bstree *old) { if((strcmp(new->keyword,old->keyword))<0 && old->lnode==NULL) { old->lnode=new; } else if((strcmp(new->keyword,old->keyword))<0 && old->lnode!=NULL) { …

Member Avatar for b1izzard
0
941
Member Avatar for Adami

I try to imitate the first stage of pre-processor, which is to remove comments from a *.c file. The main principle is that a *.c will be read and the program will create another file *.c1 which is an exact copy of *.c but without comments(c/c++ comments). Example(in Linux): >./myprog …

Member Avatar for Banfa
0
123

The End.