Like Tree1Likes
  • 1 Post By Tclausex

loop help, while loop and dowhile, lowercase to uppercase

This is a discussion on loop help, while loop and dowhile, lowercase to uppercase within the C Programming forums, part of the General Programming Boards category; i've done the for loop for this code but finding the while loop and dowhile loop tricky i would be ...

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    6

    loop help, while loop and dowhile, lowercase to uppercase

    i've done the for loop for this code but finding the while loop and dowhile loop tricky i would be grateful if somebody can help me,
    the while loop compiles but only the second character in the string is converted to uppercase the rest are not, the dowhile one does not compile completely wrong, below is what i have done so far, i can write the code in other formats but i need the ASCII values in the code thank you

    Code:
    //while loop
    
    
    #include<stdio.h>
    
    main(){
      char text[20],a;
      int i=1;
      printf("Enter any text:\n");
      scanf("%s",text);
      
      while(i<=text[a],text[a]++);
      {text[i]>=97&&text[i]<=122;
       {text[i]=text[i]-32;
    }
    }
      printf("The text in uppercase is: %s",text);
      
    }
    
    
    //dowhile
    
    #include<stdio.h>
    main(){
      char text[20];
      int i;
      printf("Enter any text:\n");
      scanf("%s",text);
      
       do{
      printf("The text in uppercase is: %s",text);
    }while(i=0;i<=text[i];i++)
               (text[i]>=97&&text[i]<=122)
                text[i]=text[i]-32;
    
      
    }

  2. #2
    Registered User
    Join Date
    Nov 2011
    Location
    Saratoga, California, USA
    Posts
    334
    For, While, and Do While Loops in C++ - Cprogramming.com

    Your use of while and do/while is pretty much way off. Read the info at the link.
    dennis.cpp likes this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to detect a lowercase or uppercase char?
    By Axel in forum C Programming
    Replies: 5
    Last Post: 09-04-2005, 12:28 PM
  2. Uppercase and lowercase
    By StarOrbs in forum C++ Programming
    Replies: 4
    Last Post: 03-09-2005, 03:18 PM
  3. Replies: 14
    Last Post: 06-06-2004, 03:51 PM
  4. Uppercase & Lowercase
    By Dennis in forum C Programming
    Replies: 2
    Last Post: 11-14-2002, 07:07 AM
  5. converting chars to uppercase/lowercase
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 05-08-2002, 07:55 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21