CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: cassas00

Search: Search took 0.01 seconds.

  1. Re: Keep getting strange results with char and scanf

    Ah got it now, was because I had more than one scanf so it repeated the question, thanks for your help
  2. Re: Keep getting strange results with char and scanf

    #include <stdio.h>

    int main()
    {
    int v;

    while (scanf("%d", &v) != 1) {
    printf("ERROR");
    v = getchar();
    scanf("%d", &v);
  3. Re: Keep getting strange results with char and scanf

    Sorry, when I paste the code doesn't indent

    #include <stdio.h>

    int main()
    {
    int v;

    while (scanf("%d", &v) != 1) {
    printf("ERROR");
  4. Re: Keep getting strange results with char and scanf

    I have this

    #include <stdio.h>

    int main()
    {
    int v;

    while (scanf("%d", &v) != 1) {
    printf("ERROR");
  5. Re: Keep getting strange results with char and scanf

    can you elaborate on approach #1 please? Having a little trouble implementing it.
  6. Re: Keep getting strange results with char and scanf

    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...
  7. Re: Keep getting strange results with char and scanf

    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.
  8. Keep getting strange results with char and scanf

    #include <stdio.h>

    int main(){
    unsigned char x, y=10;

    scanf ("%c", &x);

    x = (x)*(y);

    printf("%i", x);
  9. Replies
    3
    Views
    1,472

    Re: Problem implementing ToUpper

    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!
  10. Replies
    3
    Views
    1,472

    [RESOLVED] Problem implementing ToUpper

    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...
Results 1 to 10 of 10





Click Here to Expand Forum to Full Width

Featured