11 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for satnav_8

Here is what I'm trying to do: * Take input with scanf() * Pass input to function * Beep frequency associated with input I have notes defined, e.g `const in C5 = 523.25;` I want the user to be able to input "C5", and have the computer beep at a …

Member Avatar for Ancient Dragon
0
386
Member Avatar for somjit{}

# code to convert any base input to any base output (base limited upto hexadecimal) # ## scanf() works , but gets() stops working from 2nd iteration ## *i apolozise beforehand for the length of this post, i hope there will be someone who'll bear with me :(* **here is …

Member Avatar for WaltP
0
377
Member Avatar for vikingsheepman

Hello all! I have used this forum many times in the past to solve a variety of programming related problems, but am truly stumped on a segfault within a binary search tree. I have isolated the segfault to a fscanf statement that look legitamate to me. The following code blocks …

Member Avatar for vikingsheepman
0
262
Member Avatar for hypernova

Hi all! I was experimenting a little with scanf. I am posting the code and the outputs I am having prolems understanding: #include <stdio.h> int main() { char a,b,c; int d,e; scanf("%c%c",&a,&b);//-------------------(1) printf("%c %c\n\n",a,b); scanf("%d%d",&d,&e);//-------------------(2) printf("%d %d\n\n",d,e); scanf("%c abc",&a);//--------------------(3) printf("%c\n\n",a); scanf("%c abcdefgh",&a);//---------------(4) printf("%c\n\n",a); getch(); return 0; } In (1): Doesnt …

Member Avatar for hypernova
0
296
Member Avatar for IcyFire

Im trying to write a program that will scan both characters and numbers from a user then put the number into an array or call another function based on the user input. For example the user will type 'Insert 3' and this will call the function to put 3 into …

Member Avatar for IcyFire
0
179
Member Avatar for thendrluca

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], …

Member Avatar for thendrluca
0
325
Member Avatar for Prankmore

I am trying to take a user input phone number and perform calculations on it as an integer of type long long. I've tried this but it only reads the first 3 numbers then when it reaches the hyphen it stops. [CODE=C] printf("Enter Number: \n"); //get input from user count …

Member Avatar for Prankmore
0
3K
Member Avatar for Prankmore

[code = c][/code] I am trying to write a program that takes a 10 digit phone number and inserts hyphens between the 3rd and 4th digit and the 6th and 7th digit eg. Enter phone number: 5553459875 Your number is 555-345-9876 I've decided that reading the number as an integer …

Member Avatar for Prankmore
0
333
Member Avatar for IndianaRonaldo

i need a command in c++ to scan the first keystroke the user enters ....(i.e) user doesnt have to press <enter> key...i need to scan as soon as he types....please help...thanks in advance....

Member Avatar for IndianaRonaldo
0
174
Member Avatar for rtk1865

I have a unit conversion program that needs to take in a float and 2 strings from standard input. My previous solution was: [CODE] float orig_quant; char *orig_name = (char*) malloc(MAX_CHARS); char *new_name = (char*) malloc(MAX_CHARS); fscanf(stdin, "%f %s %s", &orig_quant, orig_name, new_name); [/CODE] However, this only works if the …

Member Avatar for Narue
0
22K
Member Avatar for garyengle

I can't seem to pass a struct address to a function. My program "stops working" when it gets to the scanf statement of the getReady function. [CODE]/**************************************************** Author: ---------------------------------------------------------------------- Purpose: This code will explore passing a data structure address to a function. ****************************************************/ #include <stdio> #include <stdlib> //prototypes: struct things{ …

Member Avatar for garyengle
0
139

The End.