15,550 Topics

Member Avatar for
Member Avatar for s88

The problem is that when I enter the choice, nothing happens and the answer remains 0. Please help I'm new at this and I tried everything!! Thanks [code=c] #include <stdio.h> #include <conio.h> main () { int a,b; float answer; char choice; clrscr(); printf ("\nEnter a number: "); scanf ("%d",&a); printf …

Member Avatar for s88
0
252
Member Avatar for clemente

In response to Hike34's thread to add a \ character to a CString, I think the \ character has a meaning in such strings and to use it in a string it should itself be preceded by a \ character CString word="hello world"; word+="\"; // or "''" doesn't work... Instead …

Member Avatar for ~s.o.s~
0
98
Member Avatar for pointers

Hi i hav executed the following c code..the inner printfs executes first and prints some garbage value...why dont the outer printf prints anything... i got only one garbage value y dont two garbage values....wt s the order of precedence in printf function and in nested printfs.... the c code is …

Member Avatar for ~s.o.s~
0
100
Member Avatar for sgriffiths

Hello can anyone help me with the following The below will actually display the Name found part, even though no name actually exists and its just blank, how do i get round this, the string name will contain blanks, but i need to check if blank, then treat as blank. …

Member Avatar for Nick Evan
0
106
Member Avatar for Manas Kumar Sen

The following profram is not compiled. Why? Please help me! //This is a file copy utility// [code] #include<stdio.h> #include<conio.h> main(int argc, char argv[]) { FILE *fs,*ft; char ch; if(argc!=3) { puts("Insufficient Arguments!"); exit(); } fs=fopen(argv[1],"r"); if(fs==NULL) { puts("Cannot open Source file"); exit(); } ft=fopen(argv[2],"w"); if(ft==NULL) { puts("Cannot open Source file"); …

Member Avatar for Nick Evan
0
79
Member Avatar for waldis

Hi, Once I had a similar problem when I tried to read a binary file on a pc and I failed, but I was able to read it in Linux (there were actually different versions of the file), so I figured it's a corrupted file, thou the hex dump looked …

Member Avatar for waldis
0
95
Member Avatar for simmyhp

Hi, I have written the code of checking already, but I have got two problems here. 1. I don't know why when I enter the number in, when it prints out the number, it becomes smilies or some kind of maths code. Please tell me what I have done wrongly …

Member Avatar for WaltP
1
100
Member Avatar for kissiwat

All I'm trying to do is write a very simple loop program in C to enter the ages of four sprogs between 5 and 7. To display their total and average age using do, while and if statements. I also need to display an error message if an invalid number …

Member Avatar for Lerner
0
140
Member Avatar for depsch

I have a basic question with a for loop statement where I have a function thats creating input nodes inside my animation program. The name thats assigned to the input that the function creates is "InputNum" . How do I tack on the value of i to the end of …

Member Avatar for WolfPack
0
111
Member Avatar for rxgmoral

problem about font i write CMFont class,it inheritance CFont e.g: [code] class CMFont:public CFont {..........}; ======================== CMFont font; font.CreateFont(...); GetDlgItem(IDC_FONTID)->SetFont(&font);[/code] [code] error error C2664: 'CWnd::SetFont' : cannot convert parameter 1 from 'CMFont **__w64 ' to 'CFont *'[/code] how to CMFont convert CFont thank:)

Member Avatar for Ancient Dragon
0
89
Member Avatar for Raj@web

[B]Hey i have been working C, But i need to do a Convolution progrm in C, So pls advice on this matter How to initialize..[/B]

Member Avatar for Salem
0
96
Member Avatar for kimw

does anyone know how I can write to a xls that puts each number in different cells? for example, [CODE]vector<int> nums; nums.push_back(1); nums.push_back(2); nums.push_back(3); ofstream myfile; myfile.open("C:/example.xls") myfile << nums[1] << " " << nums[2] << " " nums[3] << endl; myfile.close()[/CODE] how do i put three numbers in different …

Member Avatar for Salem
0
130
Member Avatar for neeven

i need to write a program that- allow the user to enter the number of students-allow the user to enter each mark-calculate the frequency for each mark-the interval that exists between identical marksthis is what i have donei want to know if there is a different way of doing it#include#define …

Member Avatar for Salem
0
231
Member Avatar for tomtat

[code]/* a program to find all the permutations of an input string pointers are not allowed*/ #include <stdio.h> #include <string.h> #include <conio.h> void main() { clrscr(); int num =0; char buff[20] ; printf("Enter the string\n"); scanf("%s",buff); int len = strlen(buff); printf("%s\n",buff); for(int i=0;i<len;i++) { for(int j=1;j<len;j++) { for(int k=j+1;k<len;k++) { …

Member Avatar for ~s.o.s~
0
98
Member Avatar for pointers

could u tell me the use of static storage class before a function...like static add(); could u tell me a good link to get collection of programes in c language.... Thnaku and Regards.

Member Avatar for ~s.o.s~
0
86
Member Avatar for neeven

i need to write a program that- allow the user to enter the number of students-allow the user to enter each mark-calculate the frequency for each mark-the interval that exists between identical marksthis is what i have donei want to know if there is a different way of doing it …

Member Avatar for indianscorpion2
0
250
Member Avatar for tirivamwe

the function first search a word from the linked list. if found it then increment the numWords (number of words in listfor that word) and if not found it shoud create a new node for the word. the code is: [CODE]void AddWords( char text[30]) { check=head; while (check!=NULL) { if …

Member Avatar for Nick Evan
0
127
Member Avatar for petzoldt01

Hello, I need to write a program that runs along with an emulator. The goal of my program is to intercept certain keystrokes before the emulator gets them, and then send the emulator back some different keystrokes. I want the program to use as few CPU resources as possible, as …

Member Avatar for iamthwee
0
125
Member Avatar for madankumar

We cannot have static friend function............ because 1.since static member functions can access only static data members...where as friend function can access all the members. 2.Friend function also require an object to access the members...where as static member functions can not. 3. Another thing ....since friend functions are non-member functions....and …

Member Avatar for ~s.o.s~
0
1K
Member Avatar for anksphenomenon

Hi I was goinf through the GTK code and saw that GTK code uses pointer for structs and not normal instances of the same structs... why could this be so? My take is that they wanted to use just one variable name and they can easily initialise the pointer to …

Member Avatar for ~s.o.s~
0
86
Member Avatar for tirivamwe

i have this line of code and want to compare the word from the linked list with the one supplied by user. the code is: [CODE] if (strcmp(p->word,word)==0)[/CODE] and i am having this error: [COLOR="Red"]passing `char' to argument 2 of `strcmp(const char *, const char *)' lacks a cast[/COLOR]

Member Avatar for tirivamwe
0
572
Member Avatar for aismm

I am supposed to use get the user input of a filename and then open that file and print to the screen (the first line-- that I will do later), and I can't figure out what I am doing wrong. Thank you. [code] #include <stdio.h> main() { char s[1000]; printf("Enter …

Member Avatar for andor
0
212
Member Avatar for tehloki

I am taking a programming course, and since we have not been introduced to string functions (puts(), gets(), etc) I need to take some input from the user using scanf. The assignment is to read a DNA sequence, storing it in a char array. The array must be 512 characters, …

Member Avatar for tehloki
0
242
Member Avatar for SammyHasibi

[code]#include <stdio.h> int function1(int a) { return(a*a*a); } int function2(int b) { int i; int sum = 0; for (i=1; i<=b; i++) sum += function1(i); return(sum); } int main () { int n, result; printf("Enter n\n"); scanf("%d", &n); result = function2(n); printf("Result = %d\n", result); system("pause"); return(0); } [/code] Explain …

Member Avatar for SammyHasibi
0
101
Member Avatar for Lun

i don't know why this program doesn't work.. it just keep on saying that it have errors..... pleae help!! please help!! [code] #include <stdio.h> #define LEX_LEN 1024 enum chars{ LETTER, DIGIT, UNKNOWN,ZERO,TULDOK, WHITESPACE,SEMICOLON,QUOTED,PLUS,MINUS, DIVIDE,LT,GT,EQ,ASS2,OPARENT,CPARENT }; enum Token { STOP, NUM, STRING,STMTSEP,QUOTED_CHAR,ERROR,ADDOPERATOR,MINUSOPERATOR,DIVIDEOPERATOR,SIGNEDNUM, SEMI,LTHAN,GTHAN,EQUAL,ASS,OPEN_PARENT,CLOSE_PARENT }; chars charclass; char nextchar; char parse_me[] = …

Member Avatar for Lun
0
141
Member Avatar for tirivamwe

can someone please help me to write a code in c to do the following: 1)read words from a file 2)store the words in a linked list 3)read the words and display 4)count the number of words in list

Member Avatar for tirivamwe
0
125
Member Avatar for taineechan

I want to find the length of a string, But the strlen function seems only to work with chars. I can't use a char[] to store my text because the size must be known beforehand and I don't know it. So I read everything into a string, then tried to …

Member Avatar for taineechan
0
134
Member Avatar for chris.lloyd

Hi, Just to make things obvious, I am a student. I have been learning C given an assignment to code a program similar to that used on the Voyager 9 probe. It uses hadamard matrices to make sure that bits transmitted through space have redundancy and are not lost. Each …

Member Avatar for chris.lloyd
0
169
Member Avatar for Mr.UNOwen

I'm having touble trying to send arrays from funciton to function. The thing I can't do is make a global variable (one of the rules set by the teacher). I don't know what I'm doing really, so let me know if it's even doable.

Member Avatar for TylerSBreton
0
115
Member Avatar for SammyHasibi

I have written a program with 2 functions which compute factorials & combinations. The functions work perfectly when called but I cannot insert a for loop at the end which sums up the combos. This part works (I have omitted the functions because they work when called for). [code]long factorial(int …

Member Avatar for SammyHasibi
0
93

The End.