是100篇C++编程实例,以源代码形式,帮助你学习C

源代码在线查看: char.cpp

软件大小: 2555 K
上传用户: cenxudong4
关键词: 100 编程实例 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include 
				#include 
				#include 
				#include 
				
				int main(void)
				{
				   int LENGTH,I;
				   char CHOICE;
				   char *STRING = "This is a string";
				   printf("\nInput the string:");
				   gets(STRING);
				   LENGTH = strlen(STRING);
				   printf("\nWhat do you want to do with the string?");
				   printf("\n1: Capital Letters(A B C ... ...)");
				   printf("\n2:Lowercase Letters(a b c ... ...)");
				   do
				   {
					printf("\nEnter you CHOICE:");
					scanf("%c",&CHOICE);
				   }
				   while((CHOICE!='1')&&(CHOICE!='2'));
				   switch (CHOICE){
					case '1':for (I=0; I							{
							STRING[I] = toupper(STRING[I]);
							};
							break;
					case '2':for(I=0; I							{
							STRING[I] = tolower(STRING[I]);
							};
							break;
				   }
				   printf("\nThe string has been changed into : %s",STRING);
				   printf("\n\nPress Any Key to EXIT... ...");
				   getch();
				   return 0;
				}			

相关资源