| Главная » Статьи » Программирование » C++ |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; namespace Lab17b13 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { FileStream f = new FileStream("D:\\lab17.s1", FileMode.Open); StreamReader sr = new StreamReader(f); int x,i,n,l; string s; comboBox1.Items.Clear(); while(!sr.EndOfStream) { i=0; n=0; s=sr.ReadLine(); l=s.Length; for(x=0;x<l;x++) if(s[x]==' ') { i++; if(i==int.Parse(textBox1.Text)) n=x; } comboBox1.Items.Add(n); } sr.Close(); f.Close(); } private void button2_Click(object sender, EventArgs e) { FileStream f = new FileStream("D:\\lab17.s2", FileMode.OpenOrCreate); StreamWriter sw = new StreamWriter(f); sw.WriteLine(comboBox1.Text); sw.Close(); f.Close(); } } }
| |
| Просмотров: 2341 | Комментарии: 5 | Рейтинг: 0.0/0 |
| Всего комментариев: 1 | ||
| ||



















