<mosaic.cnfolio.com>
PROGRAM
  1. /*course work 2 pusduo code
  2. START
  3. ADD amountofchangedletters
  4. ADD chagingletters
  5. ADD origanlestatment
  6. ADD count
  7. ADD possiosionchecking
  8. ADD posiosion
  9. ADD changingpossioncyper
  10. ADD comparing
  11. ADD changingpossiontext
  12. ADD location
  13. ADD testing
  14. ADD FreePosition
  15.  
  16. MAIN
  17.  
  18. SCAN for amountofletterschanged
  19. SCAN for changingletters
  20. SCAN for origanlelenght
  21. SCAN for origanlestatment
  22. COMPAIR compar and changinletters
  23. MAKE sure they are the same
  24. SET changingpossiontext to 0
  25. SET possisionchecking to 0
  26. SET Freeposition to 0
  27. FOR LOOP
  28. WHEN possisionchecking=0
  29. MINNUS 1 from amount of changed letters
  30. ADD one to changinposssiontext
  31. ADD one to count
  32. WHEN orignale leght is 1 more than oriable statment
  33. ADD one to possiosion
  34. IF possion and oriagnle are EQUAL
  35. SWAP oriagle and changing lettters
  36. WHEN changingpossioncyper IS= to posiosion
  37. MOVE letters
  38. PRINT old letter
  39. cyper letter
  40. and new lettter
  41. REPATE process
  42.  
  43. WHEN cyper leght + possition
  44. END for loop
  45. PRINT pricesses old letter c
  46. CHAANGHING new letter
  47. THEN changed sentaces
  48.  
  49. RETURN
  50.  
  51. END
  52.  
  53.  
  54.  
  55.  
  56. /*===========================begining(crating intergers/strings and including the libbys)==================================*/
  57.  
  58.  
  59. #include <stdio.h>
  60. #include <stdlib.h>
  61. #include <string.h>
  62.  
  63. int amountofchangedletters;       
  64.     char chagingletters[16]; //* allows more tahn one caractor //*     
  65.     int origanleleghth;         
  66.     char origanlestatment[256];         
  67.     int count=0;                 
  68.     int possisionchecking=0 ;   
  69.     int posiosion=0 ;//* posion in the string//*
  70.     int changingpossioncyper[256];//* as described//*
  71.     char comparing[16];
  72.     int changingpossiontext=0;
  73.     int location;
  74.     int testing;
  75.     int FreePosition=0;
  76.    
  77.     //*==================================setting up =========================//*
  78.    
  79.     int main(){
  80.  
  81.  
  82. for(FreePosition=0; FreePosition<257; FreePosition++) //* ceckes the values in the array //*
  83.     { changingpossioncyper[FreePosition]=257;//*Sets each array to a value of 257 witch cant be done in the code it self due to only going up to 256 im not to sure why//*
  84.     }
  85.  
  86.     //*=================================scanning section============================//*
  87.    
  88.       scanf(" %d", &amountofchangedletters);//*scaning for amount of letters//*   
  89.      //*trailbit of code but works //*
  90.    
  91.    
  92.      
  93.    
  94.  
  95.      
  96.      scanf(" %s ",&chagingletters);//*apears to work   now only dose one word //*
  97.      //* now works have the % sign the worng way round wops changed to s    //*
  98.      
  99.      scanf(" %d ",&origanleleghth);//* scans leghts of string//*
  100.     //prints leght of string prints 0?//*
  101.      
  102.      scanf(" %s" ,&origanlestatment);//* looks for orignale stamtent
  103.      //* agian works but only prits 1 word
  104.      
  105.      //* this is mucked up need to look at //*
  106.      
  107.       //*=============================setting the strings    ==================================//*
  108.      
  109.      
  110.      
  111.      strncpy (comparing,chagingletters, sizeof(comparing)); //* this sets one string to be the same as another string
  112.      
  113.      
  114.    //*===============================printing asic=========================================================//*
  115.      
  116.      //* prints a single parts of a sting as a asci value not needed  this section in the end was not needed but still here becuase it give space to think//*
  117.      
  118.      
  119.      
  120.      
  121.      //*================================ setting up   ============================================================//*
  122.      changingpossiontext=0;
  123. possisionchecking=0;
  124. count=0;
  125. FreePosition=0;//* these were all set to 0 to make sure we had a fresh start when starting the program //*
  126. //*=======================================the for loop begins =====================================//*
  127.      for(possisionchecking=0; possisionchecking<amountofchangedletters-1;
  128.      possisionchecking++) //* this checks to see where and what letter we are on //*
  129.      {
  130.     changingpossiontext++;
  131.       count++;//*each time we go round this prograsm for loop this will incress by 1
  132.       for(posiosion=0; posiosion<origanleleghth+1; posiosion++)//* loop start point//*
  133.       {
  134.    if(origanlestatment[posiosion]==chagingletters[possisionchecking])//*this is checking to see if one thing is equle to antoher //*
  135.  {
  136.  testing=0;
  137.  location=0;//* resetting stuff again//*
  138.  for(testing=0; testing<FreePosition; testing++)
  139.  { if (posiosion==changingpossioncyper[testing])//* this is looking to see if the letter is in there //*
  140.  { location++;}//* this deasls with duplicat letters //*
  141.  }     
  142.  if(location==0)//* this part deals wiht the event that there is no duplicates //*
  143.    { origanlestatment[posiosion]=comparing[changingpossiontext];//* this cahnges the text in the current position//*
  144.  
  145.  changingpossioncyper[FreePosition]=posiosion;//* moves the letter in to a diffrent array //*
  146.                      FreePosition++; }
  147.    //*=======================================================print======================================//*                 
  148.          }
  149.      } printf("proccess %d changing %c to %c \n", count, chagingletters[possisionchecking], comparing[changingpossiontext]);//* first print f //*
  150.  printf("%s \n", origanlestatment); //* second printf//*
  151.  
  152.    }
  153. changingpossiontext=0;
  154. possisionchecking=amountofchangedletters-1;//* begining to solving the problme wiht the last/fisrt bloddy letter//*
  155. posiosion=0;
  156. count=amountofchangedletters;//* same as above same proccess //*
  157. for(posiosion=0; posiosion<origanleleghth+1; posiosion++)
  158. { if(origanlestatment[posiosion]==chagingletters[possisionchecking])
  159.     { testing=0;                                                                                           
  160.     location=0;//* resetting them both again//*
  161.              for(testing=0; testing<FreePosition; testing++)
  162.                 { if (posiosion==changingpossioncyper[testing])
  163.                 {
  164.             location++;}
  165.          }     
  166.      if(location==0)
  167.        {
  168.  origanlestatment[posiosion]=comparing[changingpossiontext];
  169.  changingpossioncyper[FreePosition]=posiosion;
  170.                      FreePosition++; }
  171. //*================================================final print=================================================//*                     
  172.       }
  173.       }
  174.       printf("processes %d changing %c to %c \n", count, chagingletters[possisionchecking], comparing[changingpossiontext]);
  175. printf("%s \n", origanlestatment)
  176.      
  177. return 0;
  178. }
  179.  //* coad finihses here //*