using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace reversing_of_string
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string str, revstring;
int length;
private void button1_Click(object sender, EventArgs e)
{
// string sac;
str = txtrev.Text;
length = str.Length - 1;
while (length>=0)
{
// sac = length + 1.ToString();
revstring = revstring + str[length];
length--;
}
MessageBox.Show(revstring);
}
private int getcount(string text)
{
int wordcount=text.Split(' ').Length;
return wordcount;
}
private void button2_Click(object sender, EventArgs e)
{
int mm = getcount(txtrev.Text);
MessageBox.Show(mm.ToString());
}
}
}
No comments:
Post a Comment