| | |
Problem Ish getchar put char
![]() |
0
#3 Oct 19th, 2009
•
•
•
•
I actually had a bad experience with that when A classmate stole my work turned it in and i got in trouble
But it's going to be awfully difficult for anyone here to help without some code to look at. At least provide more specific information on your issue with a minimal amount of code that demonstrates your problem.
Manic twiddler of bits
•
•
Join Date: Oct 2009
Posts: 5
Reputation:
Solved Threads: 0
0
#4 Oct 20th, 2009
i will gladly pm u the code the problem is I have to enter the code as follows
(spaces)(num1(spaces)(operand either :+-%/*)(spaces) (num2)
I get my first function by doing
no matter what i try for the second operand or the second num I fail...
although i just came up with this
do another while loop for second num, and then from there open an if statement that says if operand then another if statement inside that says getchar save that getchar as a digit and retrn t, would that work?
(spaces)(num1(spaces)(operand either :+-%/*)(spaces) (num2)
I get my first function by doing
C Syntax (Toggle Plain Text)
int makenum(void) { int digit, num1=0,opperator=0; while (( digit = getchar() ) !='/n') { if ((digit>='0') && (digit<='9')) { num1= num1 * 10 + (digit - '0'); if /*((digit == '*') ||(digit == '/') ||(digit == '-') ||(digit == '+') ||(digit == '%'))*/(digit = ' ') break; } } return (num1); }
although i just came up with this
do another while loop for second num, and then from there open an if statement that says if operand then another if statement inside that says getchar save that getchar as a digit and retrn t, would that work?
![]() |
Similar Threads
- PROBLEM: getchar() does not work within a function. (C)
- Easy problem i tried to fix it i just can't do it (C++)
- problem with a with loop (C++)
- Problem with getline with input files (C++)
- Problem with getchar() (C)
- I/O question. using vc++ read char by char (C++)
- Header File.... simple (C++)
- Problem with self-managing buffer (C++)
- can a vector take array of char(char *) (ASP.NET)
Other Threads in the C Forum
- Previous Thread: Need help with a booking ticket program
- Next Thread: Can someone please help describe this semaphore example?
| Thread Tools | Search this Thread |
#include adobe ansi api array asterisks binarysearch changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic execv feet fgets file fork forloop frequency function getlasterror givemetehcodez global grade graphics gtkgcurlcompiling hacking hardware highest histogram i/o include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue mysql number odf opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf segmentationfault sequential shape socket socketprograming standard string systemcall threads turboc unix user voidmain() wab windows.h windowsapi






