83 Posted Topics

Member Avatar for johnray31

[icode]typedef struct_compare[/icode] is [icode]typedef struct compare[/icode]. I guess it was just a typo. I created a sample structure 'compare' and created two variables of type 'compare'. I initialized the members of one type and assigned it to the other using '=' operator. It seemed to work fine. Did i miss …

Member Avatar for ArkM
0
123
Member Avatar for galmca

So you really believe that the person who posted this problem is still waiting for an answer even after TWO years and wants to look at crappy looking code?

Member Avatar for devnar
0
260
Member Avatar for atman

[code=c] #include <stdio.h> #include <stdlib.h> #include <conio.h> #define MAX 10 int main() { char ch, str[MAX]; int i=0; do { ch=getch(); if(ch>='0'&& ch<='9') { //Code here printf("%c",ch); str[i++] = ch; } else if(ch!='\r') { printf("\nDo not enter alphabet. It'll be ignored\n"); printf("Enter the no again\n"); for(i=0;i<MAX;i++) str[i] = '\0'; i=0; …

Member Avatar for devnar
0
97
Member Avatar for gunjanagrawal

[QUOTE=rohanvijay;726520]im having lot of problems in c and c++ programs...can u please tell me the sites where i ciuld find the solutions of almost all c/c++ programs..[/QUOTE] Solutions to [B]ALMOST ALL[/B] C/C++ programs? That's asking for quite a lot, dontcha think? We don't even have [B]ALMOST ALL[/B] C/C++ problems yet. …

Member Avatar for nucleon
-1
184
Member Avatar for IrishUpstart

[QUOTE=rohanvijay;726523]how to write the C program of pyramid: 1 2 3 4 5 6 7 8 8 10[/QUOTE] Start a new thread for that. Sheesh!

Member Avatar for devnar
0
102
Member Avatar for henks

[QUOTE=ddanbe]I don't know what your problem is, but I appreciate your efforts. Divide your decimal number by 2. Record the remainder(should be 0 or 1) divide again and record again until your decimal number becomes zero. The record of 0 and 1 digits is your binary number. Do the reverse …

Member Avatar for henks
0
144
Member Avatar for sharpst

[url]http://www.daniweb.com/forums/announcement118-2.html[/url] Show us what you've got so far. If you're totally clueless about what you've to do, i'll give you a head start. Here's what the program should do: 1. Promt the user for a choice. (1.addition 2. subtraction 3. multiplication and so on) 2. Read the choice using scanf() …

Member Avatar for ajay.krish123
0
781
Member Avatar for yinfu89

[url=http://www.daniweb.com/forums/thread93280.html]Code tags[/url] Your problem states that you have to [B]read[/B] 20 integers which means that you'll have to use scanf() to get the input from the user. Then you've to display the [B]number[/B] of even and odd numbers present. [code] while(there are still nos to read) //or no of integers …

Member Avatar for ddanbe
0
131
Member Avatar for ahfan_85

In the sorting algorithm, [icode]for(index = 0;index < num;index++)[/icode] should be [icode]for(index = 0;index < num-1;index++)[/icode] That's one extra useless iteration to perform. Also, if num=10, then in your code, when index = 9, next = 10. Then mark[next] (which is mark[10]) will have a garbage value.

Member Avatar for ahfan_85
0
294
Member Avatar for kyeong

What's [icode]departure_time[/icode] and [icode]arrival_time[/icode] doing in the function? You've passed them as arguments in the function, but they aren't being made to point to anything. Better thing to do would be to assign them to the variable pointed to by [icode]best_index[/icode] in both [icode]departure_times[][/icode] and [ICODE]arrival_times[][/ICODE] and do all the …

Member Avatar for devnar
0
148
Member Avatar for msundastud

>>And you cannot declare void function and then expect to get some result from it Is it a bad practice or against the standard? Cause even i use it in functions when I want to pass control back to the main function. I know the convert function in this program …

Member Avatar for devnar
0
161
Member Avatar for kinger29

The problem is to print the obtained remainders in the reverse order which implies that you'll have to store some sort of information abt what remainders you obtained in the previous step. One way to do it is to use a character array as such: [icode]char convert = "01";[/icode] Then …

Member Avatar for devnar
0
179
Member Avatar for MyRedz

1. [url=http://www.daniweb.com/forums/thread93280.html]Code tags[/url] 2. Your program makes no sense. Even your problem statement is a li'l confusing. Do you want to make the user aware of the error when he inputs a number other than 0 or 1 or do you wanna convert every input into 0 or 1 using …

Member Avatar for Aia
0
103
Member Avatar for anny**

Also you are compiling the program as a *.cpp. I think it should be *.c. But it's pretty irrelevant since you don't even have the required header file.

Member Avatar for devnar
0
226
Member Avatar for nishant3316

All warring aside. . . Please be more specific when you post the thread. Your first post barely gives any info on what your problem is and where you are stuck up. >but i don't know the syntax for using it.. If your problem is only finding out the syntax, …

Member Avatar for ahamed101
0
209
Member Avatar for jared_masc

Nobody's gonna go through that code if you don't use code tags. Here's how: [url]http://www.daniweb.com/forums/thread93280.html[/url]

Member Avatar for stilllearning
0
242
Member Avatar for En-Motion

>>Here's another redirection [url]http://cboard.cprogramming.com/showthread.php?t=107852[/url] That's wicked dude!

Member Avatar for ahamed101
0
297
Member Avatar for rrreeefff

[icode]scanf ("%d", &a);[/icode] a is declared as a float, so %d should be %f. Function definition- [icode]int mypower(float a, int n);[/icode] there's no semicolon at the end. (as Salem pointed out.) [icode]int power[/icode] [icode]return 0.0;[/icode] I think power should be declared a float. You might get a warning for that.

Member Avatar for devnar
0
496
Member Avatar for makubexiii

[icode]Insert(nd *head);[/icode] Shouldn't the above be [icode]Insert(nd head);[/icode]? You've already used typedef to make a variable of type 'nd' a pointer to struct node. So when you declare [icode]Insert(nd *head);[/icode], i think head becomes a pointer to a pointer to a structure. Even i'm still learning, so correct me if …

Member Avatar for makubexiii
0
136
Member Avatar for devnar

I found the following code in the 'Code snippets' section( written by nanodano). i tried compiling it in my Dev-Cpp compiler, and i got the output as shown in the attachment for up, left, down and right arrow keys respectively. All other defined keys i.e., F1 to F10 gave the …

Member Avatar for devnar
0
196
Member Avatar for devnar

[CODE=C]#include<stdio.h> #include<conio.h> int main() { float a=0.7; if(a<0.7) printf("C"); else printf("C++"); getch(); return 0; }[/CODE] The above code prints 'C'. Whereas the following two codes prints 'C++'. Why is that? [CODE=C]#include<stdio.h> #include<conio.h> int main() { float a=0.7; if(a>0.7) printf("C"); else printf("C++"); getch(); return 0; }[/CODE] [CODE=C]#include<stdio.h> #include<conio.h> int main() { …

Member Avatar for smart_pc
0
584
Member Avatar for devnar

I have tried to come up with a 2-D (4 rows and 4 columns) array which holds values from 0 to 15, with none of the values used more than once. I'm posting only the code snippet. please lemme know if the logic is correct. [CODE=C] int HIGH=16; /*(Max value …

Member Avatar for devnar
0
107
Member Avatar for lilgrneyes

Even i'm prettty much new to C programming, but i'll try my best to help. One of the errors is the illegal use of 'address of' operator. When you use the "&" in ur printf statements, it'll print the address of the variable and not it's value. And if u …

Member Avatar for devnar
0
94