Thanks everyone for your post on my previous question I sure learnt from it 
especially from Paul Herring's post. Thanks.

Now I'm trying to write a programme to convert lowercase to uppercase,


I wrote this myself(phew! wasn't easy)

#include<stdio.h>
main()
{
  char lett[80];
  int convt,i=0;

  convt='a'-'A';
  printf("Enter the word in lowercase \n");
  gets(lett);

  for(i=0;(lett[i]>='a')&&(lett[i]<='z');i++)
  {
      if(lett[i]==' ')
      printf("\t");

      else lett[i]-=convt;

  }

  puts(lett);
}

 
But the problem is, after a space it doesn't convert to uppercase anymore, I've 
tried some logic to fix it, (thats why the if statement is there) but it 
doesn't work

 I got this from the textbook I'm reading. it has the same problem too.


#include<stdio.h>
main()
{
  char str[80];
  int i,delt='a'-'A';
  printf("Enter a string less than 80 characters:\n");
  gets(str);
  i=0;
  while(str[i])
  {
    if ((str[i]>='a')&&(str[i]<='z'))
  str[i]-=delt;
  ++i;
   }
 printf("The entered string is (in uppercase):\n");
 puts(str);
 return 0;
}





By the way, the compiler (or software) I use is SILVERFROST(/PLATO);


      

[Non-text portions of this message have been removed]

Reply via email to