Advertisement
finySTAR

2006_túlindexel_megint

May 12th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace feherje
  9. {
  10.     class ameno
  11.     {
  12.         public string rovid;
  13.         public string betujel;
  14.         public int C;
  15.         public int H;
  16.         public int O;
  17.         public int N;
  18.         public int S;
  19.     }
  20.     class Program
  21.     {
  22.         static void Main(string[] args)
  23.         {
  24.             //1.Feladat
  25.             StreamReader olvas = new StreamReader("aminosav.txt",Encoding.Default);
  26.             List<ameno> amino = new List<ameno>();
  27.             int j = 0;
  28.             while (!olvas.EndOfStream)
  29.             {
  30.                 string sor = olvas.ReadLine();
  31.                 string[] n = sor.Split(' ');
  32.                 amino.Add(new ameno());
  33.                 if (j==)
  34.                 {
  35.                     amino[j].rovid = n[0];
  36.                     amino[j].betujel = n[1];
  37.                 }
  38.                 amino[j].C = int.Parse(n[2]);
  39.                 amino[j].H = int.Parse(n[3]);
  40.                 amino[j].O = int.Parse(n[4]);
  41.                 amino[j].N = int.Parse(n[5]);
  42.                 amino[j].S = int.Parse(n[6]);
  43.                 j++;
  44.             }
  45.             olvas.Close();
  46.             int molekula_tomeg = 0;
  47.             for (int i = 0; i < amino.Count; i++)
  48.             {
  49.                 molekula_tomeg = amino[i].C*12 + amino[i].H*1 + amino[i].O*16 + amino[i].N*14 + amino[i].S*32;
  50.                 Console.WriteLine("Molekulatömeg:{0}",molekula_tomeg);
  51.             }
  52.             Console.ReadLine();
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement