34 Discussion / Question Topics
Remove Filter
|
|
Currently doing C programming homework, I want to update the value in the file. But now I'm having a problem updating it. The problem I faced now was the codes below update the values but in the form of new lines. Instead of replace the original lines. What's wrong with … |
|
when converting iget erros especially in the cin parts because they are automatically passed by something #include<iostream> #include<conio.h> #include<math.h> using namespace std; int p=1; class Bank { public: char name[50],address[90],type; double ein_betrag, aus_betrag; double balance; int costumernr, accountnr, birth, tel; public: void newcostumer(); void newaccount(); void costumerdel(); void accountdel(); void … |
|
Hi, i have this project where the size, 2d array of size n is scanned from a file; asks for the vertex pairs from the command prompt until the user decides to stop inputting them. There is something wrong with my code because it skips the scanning of int variables … |
|
** # import a data table with space? # ** Good day! I need to read in all the data in a file within column two and export it in a file. The issue is the data is not standard and has blank fields from time to time. It also … |
|
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 … |
|
|
Hi, I am trying to write a program which read a certain input in a particular format and then gives an ouput. I wrote a code to read the file. Input is something like this. X 20 60 80 90 X 78 98 97 96 X 34 35 43 23 … |
Hi I have the following code which is giving an error while trying to use scanf with it. Please help resolve uint16_t x[3]={1,2,3}; uint16_t y; printf(" %"PRIu16",y); (works) printf("Enter a value for y: "); scanf("%"PRIu16, &y); warning: format '%u' expects argument of type 'unsigned int *', but argument 2 has … |
|
I need help with this http://codepad.org/FNUci22s I am posting the ling of code pad because it has a way to execute it, so long story short. I use two different functions seno, sen (both for sin). When using the printf and adressing both to compare results I get from the … |
|
After much searching I cannot find a particular way to get a datafile into my structure. I understand how to create and manipulate the structure. C does not play nicely with strings is another thing I have noticed. I have tried many examples of how to do this but none … |
|
# 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 … |
|
anybody help me "how to write our own (by user) scanf function so that it will works exactly as scanf function defined in liberary, what will be its declaration and definition ". |
|
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 … |
|
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 … |
|
|
My code is this atm: #include <stdlib.h> #include <stdio.h> int main(int argc, char *argv[]){ int a,b,c; int swap; printf("Enter 3 Numbers (# # #):"); scanf("%d %d %d", &a,&b,&c); //does all its computing, to see which one is biggest. return EXIT_SUCCESS; } The result when i run it in eclipse is … |
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 … |
|
Hello! I have a problem. I can't use scanf() to set a value of the second member of the person struct. Why? I get an error that tells me "bad access". [CODE]int main(int argc, const char * argv[]) { struct Adress{ char *street; char *postal; int zip; }; struct Person{ … |
|
|
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], … |
Hi all, I am just going through C++ basics now and I read that enum types cannot be input directly with cout and cin and such.And also that type coercion from int to enum is not allowed.But when i do this, [CODE] enum SumEnum{ENUM1,ENUM2,ENUM3} SumEnum VarEnum; scanf("%d",&VarEnum); printf("%d",VarEnum); [/CODE] It … |
|
In a language named vJass I can do this: [CODE] function Initialization takes nothing returns nothing string array s call read(s[1]) call read(s[2]) call print(s[1] + " " + s[2]) endfunction[/CODE] It takes two strings from user and prints them. I am totally confused how I can do this in … |
|
I'm trying to read user input and store it as a string including the whitespace. I did a search for a solution and was pointed to fgets() or scanf(%[^\n], str). But both these solutions give me an error. This is what I have: [CODE] scanf("%d", &input); if (input == 1){ … |
|
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 … |
|
[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 … |
|
Hello I have been using c for dummies along with bloodshed software for a day or so and I tried putting this snippet of code in from the book and I got a syntax error:[CODE]#include <stdio.h> int main() { char name[20]; char color[20]; printf(“What is your name?”); scanf(“%s”,name); printf(“What is … |
|
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.... |
|
Hi friends, well... i'm asking for another help from you guys.hope you will... My friend sent me a email asking why the following code doesn't work properly.I'm also couldn't understand what's happening..When this program run it supposed to prompt two times to enter values.but its actually prompt once. I tried … |
|
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 … |
|
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{ … |
|
[CODE]main() { char name[10],s[12]; scanf("\"%[^\"]\"",s); }[/CODE] How this scanf will scan? |
|
Hi, every one know that scanf statement should use "&" ambers ion symbol, but why it is not used while getting a string. eg: main() { int a; char str[10]; scanf("%d",[COLOR="Red"]&[/COLOR]a); scanf("%s",str); -->why "&" sybbol is not used in getting string? } |
|
Hi all. Just a quick question for anyone who may be able to ehelp. If a user is to enter a choice and i use scanf to read it in. When that choice is a character that is entered, if the user enters either a character that is not that … |
The End.