November 12th, 2013, 02:03 PM
Ah got it now, was because I had more than one scanf so it repeated the question, thanks for your help
November 12th, 2013, 01:56 PM
#include <stdio.h>
int main()
{
int v;
while (scanf("%d", &v) != 1) {
printf("ERROR");
v = getchar();
scanf("%d", &v);
November 12th, 2013, 01:45 PM
Sorry, when I paste the code doesn't indent
#include <stdio.h>
int main()
{
int v;
while (scanf("%d", &v) != 1) {
printf("ERROR");
November 12th, 2013, 01:38 PM
I have this
#include <stdio.h>
int main()
{
int v;
while (scanf("%d", &v) != 1) {
printf("ERROR");
November 12th, 2013, 01:32 PM
can you elaborate on approach #1 please? Having a little trouble implementing it.
November 12th, 2013, 01:13 PM
I see your point.
How would I ensure scanf only accepts numbers?
while ((answer >='a' && answer <='z')||(answer >='A' && answer <='Z'))
{
printf ("Error, invalid input, please...
November 12th, 2013, 01:02 PM
I want it to be a char, the program will only ever hold numbers from 1-12 so I'm using char to save memory.
November 12th, 2013, 12:19 PM
#include <stdio.h>
int main(){
unsigned char x, y=10;
scanf ("%c", &x);
x = (x)*(y);
printf("%i", x);
November 6th, 2013, 06:26 AM
Ah, I think I'm getting too far ahead of myself. I'll wait to see how my tutor implements it in c# in my upcoming lessons rather than using c++ code lol thanks!
November 6th, 2013, 05:46 AM
I have searched and tried so many combinations to implement ToUpper into my program but it simply doesn't work so I'm resorting to the message boards!
I'm coding in C# and I use Visual 6 C++ at...