2017-02-22 2 views
0

그래서 여기 내 코드입니다 :문자열의 문자를 바꾸고 편집하는 방법은 무엇입니까?

main() 
{ 
     char input[150];                  //Create a variable of type char named input to store user input 

     printf(" Enter a standard line: ");              //Ask the user for some standard input 

     if (fgets(input, 150, stdin) == NULL)             //Initiate a series of checks to make sure there is valid input 
     { 
       puts(" End-of-File or Input Error Detected. ");         //If the end of the file is reached or there is a problem with input output a message 
     } 
     else if (input[0] == '\n')                //If the user neglected to enter anything output a message 
     { 
       puts(" Oops! Looks like you forgot to enter something! "); 
     } 
     else 
     { 
       printf(" Here's what you entered: %s ", input);         //If there is valid user input echo it back to the user 

       while (input[0] != '\n') 
       { 

         (can I put the while loop here?) 
       } 
     } 
} 

난 그냥 내 코드를 실행할 수있어 (여기에 유래에 Chux의 제공) 지금은 또 다른 문제가 있습니다. 이제는 입력이 있는지 확인할 수있게되었으므로 특정 문자를 ASCII 코드로 바꾸고 알파벳 문자를 변경하고 줄을 바꿈으로써 그에 따라 입력 줄을 바꾸고 조정해야합니다. 1. 사용자 입력 : google.COM/search?client 사용자에게 다시 같은
2. 프로그램 변경 및 인쇄 : 나는 그렇게 어떻게 GOOGLE.com % 2FSEARCH % 3FCLIENT

예를 들어

? while 루프를 그대로 둘 수 있습니까?

+0

더 구체적으로 루프의 난을 높이기 위해 시도의 당신의 입력 [0] \ 같다 가정 해 봅시다 N이 루프는 영원히 계속 귀하의 질문에하시기 바랍니다. –

+0

@kishanoza 나는 내가 아주 구체적이라고 생각했다. 아니면 내가해야 할 일의 예를 들어야한다는 뜻입니까? – Polly

+0

정확히 예를 넣어주세요 –

답변

0

----> while (input [0]! = '\ n');

어쩌면 입력 [I]! = '\ n을'처럼을하고

관련 문제