Breaking News
Loading...
Wednesday, August 22, 2012

Nhập dòng chữ, cho chạy qua chạy lại trên màn hình console

8/22/2012 08:49:00 PM


using System; 
using System
.Collections.Generic; 
using System
.Linq; 
using System
.Text; 
using System
.Threading; 
namespace vanviet
{ 
    class 
Program 
    
{ 
        static 
void Main(string[] args) 
        { 
            
string S; 
            
Console.Write("Nhap chuoi S: "); 
            
Console.ReadLine(); 
            
int l = (int)S.Length; 
             
            for (
int i 0<= Console.WindowWidthi++) 
            { 
                
Console.SetCursorPosition(i10); 
                
Console.WriteLine("{0}"S); 
                
Thread.Sleep(50); 
                
Console.Clear(); 
                if (
Console.KeyAvailable == true) 
                { 
                    
ConsoleKeyInfo k; 
                    
Console.ReadKey(); 
                    if (
k.Key == ConsoleKey.Escape) 
                        return; 
                } 
                if (
== Console.WindowWidth l) 
                { 
                    for (
int j Console.WindowWidth l>= 0j--) 
                    { 
                        
Console.SetCursorPosition(j10); 
                        
Console.WriteLine("{0}"S); 
                        
Thread.Sleep(50); 
                        
Console.Clear(); 
                        if (
== 0) 
                            
0; 
                        if (
Console.KeyAvailable == true) 
                        { 
                            
ConsoleKeyInfo k; 
                            
Console.ReadKey(); 
                            if (
k.Key == ConsoleKey.Escape) 
                                return; 
                        } 
                    } 
                } 
            } 

        } 
    } 
 

0 comments:

Post a Comment

 
Toggle Footer