CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: encryption

Threaded View

  1. #1
    Join Date
    Jun 2009
    Posts
    16

    encryption

    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace CMH_ENCRYPT
    {
        class Program
        {
            static void Main(string[] args)
            {
                string Name,Value;                  //declaration of variable
                int Output;
                int Formula;
    
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("\n\n\t\t\t\t"+"ENTER NAME:");               //INPUTING VARIABLE Name
                Name = Console.ReadLine();
                
            
    
                Console.Write("\n\n\t\t\t      "+"ENTER VALUE (1-10): ");     //NUMBER THAT WILL ADD TO 9%10
                Value = Console.ReadLine();
    
    
                Formula =(Convert.ToInt32(Value)+ 9) % 10;  //FORMULA IN GETTING THE ENCRYPTION
                                                            
    
               
                for (int i = 0; i < Name.Length; i++)       //WILL TRAVERSE THE ENTIRE CHAR
                {
                     Convert.ToInt32(Name[i]);              //WILL CONVERT NAME TO INT
                     Output = Formula + Name[i];            //ENTERING THE SUM OF FORMULA AND NAME TO LOCAL VARIABLE OUTPUT
    
                     Console.Write("the encryption is: " + "{0}",Convert.ToChar(Output));   //DISPLAY THE OUTPUT
    
    
                }
                Console.Read();
    
                    
                
    
               
    
            }
        }
    }

    this program is already ok but i want to include spacing .

    how to do that. .
    Last edited by Shuja Ali; July 3rd, 2009 at 01:43 PM. Reason: Added Code Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured