Latest Videos from YouTube

c++ sturct+array+loop

[postlink] http://uknow-iknow.blogspot.com/2016/11/c-sturctarrayloop.html[/postlink] #include<iostream>
#include <cstdlib>
#include<string>
using namespace std;

struct students{
int id;
char name[30];
char sex[1];
float scores1;
float scores2;
float avg;
};

void input_info(struct students s[],int n)
{
int i;
for(i=0;i<n;i++)
{
cout<<"_________________________________________________________________________________________"<<endl;
cout<<"ID : "<<i+1<<endl;
cout<<"Name :";cin>>s[i].name;
gd:
cout<<"Sex (f/m) :";cin>>s[i].sex;
if(s[i].sex[0]!='f' && s[i].sex[0]!='m' && s[i].sex[0]!='F' && s[i].sex[0]!='M')
{
cout<<"\nInvalide Gender(M/F), Please Check and try again ...!"<<endl;
goto gd;
break;
}

s1:
cout<<"Score1 : ";cin>>s[i].scores1;
if(s[i].scores1<0 || s[i].scores1>100)
{
cout<<"\nInvalide Number of Score( 0p - 100p ), Please Check and try again ...!"<<endl;
goto s1;
break;
}

s2:
cout<<"Score2 : ";cin>>s[i].scores2;
if(s[i].scores2<0 || s[i].scores2>100)
{
cout<<"\nInvalide Number of Score( 0p - 100p ), Please Check and try again ...!"<<endl;
goto s2;
break;
}
s[i].avg=(s[i].scores1+s[i].scores2)/2;
}
}

void data(struct students s[],int n)
{
int i;
cout<<"_________________________________________________________________________________________"<<endl;
cout<<"ID\tName\t\t\tSex\tScore_1\t\tScore_2\t\tAvg\tResult"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
for(i=0;i<n;i++)
{
if(s[i].avg>=0&&s[i].avg<50)
{
cout<<i+1<<"\t"<<s[i].name<<"\t\t\t"<<s[i].sex<<"\t"<<s[i].scores1<<"\t\t"<<s[i].scores2<<"\t\t"<<s[i].avg<<"\tFail"<<endl;
}
else
{
cout<<i+1<<"\t"<<s[i].name<<"\t\t\t"<<s[i].sex<<"\t"<<s[i].scores1<<"\t\t"<<s[i].scores2<<"\t\t"<<s[i].avg<<"\tPass"<<endl;
}
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
}

int main(){
struct students s[50];
int n,i,j,num,d;
float av;
char search[1],ch,chpf[1];
do
{
system("cls");
en_num:
cout<<"Enter Number : "; cin>>n;
if(n>0){
input_info(s, n);
data(s,n);
number:
cout<<"\n1) Search by Sex."<<endl;
cout<<"2) Search by Avg."<<endl;
cout<<"3) Serach Follow result(p/f)"<<endl;
cout<<"Choose Number for Search(1,2,3) : ";cin>>num;
if(num==1)
{
sch:
cout<<"1) Press F for Femal, Press M for Male(F/M) : ";cin>>search;
if(search[0]=='f'||search[0]=='F')
{
cout<<"_________________________________________________________________________________________"<<endl;
cout<<"ID\tName\t\t\tSex\tScore_1\t\tScore_2\t\tAvg\tResult"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
i=0;
while(i<n)
{
int j=i;
while(j<=n)
{
if((s[j].sex)[i]=='f'||(s[j].sex)[i]=='F')
{
if(s[j].avg>=0&&s[j].avg<50)
{
cout<<j+1<<"\t"<<(s[j].name)<<"\t\t\t"<<s[j].sex<<"\t"<<s[j].scores1<<"\t\t"<<s[j].scores2<<"\t\t"<<s[j].avg<<"\tFail"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
if(s[j].avg>=50&&s[j].avg<=100)
{
cout<<j+1<<"\t"<<(s[j].name)<<"\t\t\t"<<s[j].sex<<"\t"<<s[j].scores1<<"\t\t"<<s[j].scores2<<"\t\t"<<s[j].avg<<"\tPass"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
}
j++;
}
i++;
}
}

else if(search[0]=='m'||search[0]=='M')
{
cout<<"_________________________________________________________________________________________"<<endl;
cout<<"ID\tName\t\t\tSex\tScore_1\t\tScore_2\t\tAvg\tResult"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
i=0;
while(i<n)
{
int j=i;
while(j<=n)
{
if((s[j].sex)[i]=='m'||(s[j].sex)[i]=='M')
{
if(s[j].avg>=0&&s[j].avg<50)
{
cout<<j+1<<"\t"<<(s[j].name)<<"\t\t\t"<<s[j].sex<<"\t"<<s[j].scores1<<"\t\t"<<s[j].scores2<<"\t\t"<<s[j].avg<<"\tFail"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
if(s[j].avg>=50&&s[j].avg<=100)
{
cout<<j+1<<"\t"<<(s[j].name)<<"\t\t\t"<<s[j].sex<<"\t"<<s[j].scores1<<"\t\t"<<s[j].scores2<<"\t\t"<<s[j].avg<<"\tPass"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
}
j++;
}
i++;
}
}

else
{
cout<<"Check gender again "<<endl;
goto sch;
}
}

else if(num==2)
{
cout<<"\n2) Please Enter Number of Average for search : ";cin>>av;
cout<<"_________________________________________________________________________________________"<<endl;
cout<<"ID\tName\t\t\tSex\tScore_1\t\tScore_2\t\tAvg\tResult"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
int j=0;
while(j<n)
{
if((s[j].avg)==av)
{
if(s[j].avg>=0&&s[j].avg<50)
{
cout<<j+1<<"\t"<<(s[j].name)<<"\t\t\t"<<s[j].sex<<"\t"<<s[j].scores1<<"\t\t"<<s[j].scores2<<"\t\t"<<s[j].avg<<"\tFail"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
if(s[j].avg>=50&&s[j].avg<=100)
{
cout<<j+1<<"\t"<<(s[j].name)<<"\t\t\t"<<s[j].sex<<"\t"<<s[j].scores1<<"\t\t"<<s[j].scores2<<"\t\t"<<s[j].avg<<"\tPass"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
}
j++;
}
}

else if(num==3)
{
pf:
cout<<"\n3) Press \"P\"or \"F\" for search data Pass or Fail(P/F) : ";cin>>chpf;
if(chpf[0]=='f'||chpf[0]=='F')
{
cout<<"_________________________________________________________________________________________"<<endl;
cout<<"ID\tName\t\t\tSex\tScore_1\t\tScore_2\t\tAvg\tResult"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
int j=0;
while(j<n)
{
if((s[j].avg)>=0&&(s[j].avg)<=50)
{
cout<<j+1<<"\t"<<(s[j].name)<<"\t\t\t"<<s[j].sex<<"\t"<<s[j].scores1<<"\t\t"<<s[j].scores2<<"\t\t"<<s[j].avg<<"\tFail"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
j++;
}
}
else if(chpf[0]=='p'||chpf[0]=='P')
{
cout<<"_________________________________________________________________________________________"<<endl;
cout<<"ID\tName\t\t\tSex\tScore_1\t\tScore_2\t\tAvg\tResult"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
int j=0;
while(j<n)
{
if((s[j].avg)>=50&&(s[j].avg)<=100)
{
cout<<j+1<<"\t"<<(s[j].name)<<"\t\t\t"<<s[j].sex<<"\t"<<s[j].scores1<<"\t\t"<<s[j].scores2<<"\t\t"<<s[j].avg<<"\tPass"<<endl;
cout<<"-----------------------------------------------------------------------------------------"<<endl;
}
j++;
}
}
else
{
cout<<"\nPlease check of you result again "<<endl;
goto pf;
break;
}
}

else
{
goto number;
}
cout<<"\nDo you want to choose number for search again ?(y/n) : ";cin>>ch;
if(ch=='y'||ch=='Y')
{
goto number;
}
}

else
{
cout<<"\nPlease check Number for Enter (1 to many )"<<endl;
break;
}
cout<<"\nDo you want to Creat Data again ?(y/n) : ";cin>>ch;
}
while(ch=='y'||ch=='Y');
return 0;
}



//output






Dev C++ simple in bank

[postlink] http://uknow-iknow.blogspot.com/2016/09/dev-c-simple-in-bank.html[/postlink] #include<iostream>
#include <cstdlib>

using namespace std;

int main()
{
int n, sub = 0;
char ch;
double Acc, rate, ra, to, presvalue;
do
{
system("cls");
cout<<"Amount of Money  : ";cin>>presvalue;
cout<<"During(Month)    : ";cin>>n;
cout<<"Rate for a Month : ";cin>>ra, cout<<endl;
Acc=(float)presvalue/n;
cout<<" Month \tPresent Value \tAccumalate\tRate\t\t\tTotal"<<"\n";
for(int i = 1;i<=n;i++){
rate = presvalue * ra;
if(presvalue>=Acc)
{
to = Acc + rate;
}
else
{
to = presvalue + rate;
}
sub =sub+to;
cout<<" "<<i;
cout<<"\t"<<presvalue<<"\t\t"<<Acc<<"\t\t"<<rate<<"\t\t\t"<<to<<endl;
cout<<"--------------------------------------------------------------------------"<<endl;
presvalue = presvalue - Acc;
}
cout<<"\t\t\t\t\t\t\tSubTo :\t"<<sub<<endl;
cout<<"--------------------------------------------------------------------------";
cout<<"\nDo you want to try again ? (y/n) : "; cin>>ch;
}while(ch=='y');
return 0;
}

this is result :


C# Calculator Simple

[postlink] http://uknow-iknow.blogspot.com/2016/09/c-calculator-simple.html[/postlink] 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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        Double value = 0;
        String operation = "";
        bool op = false;
        Double total_value = 0;
        Double old_value = 0;
        String old_operation = "";
        public Form1()
        {
            InitializeComponent();
        }

        private void btn_Click(object sender, EventArgs e)
        {
         
            if ((txtResult.Text == "0")||(op))
                txtResult.Clear();
            op = false;
            Button b = (Button)sender;
            if (b.Text == ".")
            {
                if (txtResult.Text.Trim() == "")
                    txtResult.Text = "0";
                if (txtResult.Text.Contains("."))
                    return;
                txtResult.Text += ".";
            }
            else
            {
                txtResult.Text = txtResult.Text + b.Text;
            }
            if(txtResult.Text.Trim() != ".")
            old_value = Double.Parse(txtResult.Text);
        }

        private void btnCE_Click(object sender, EventArgs e)
        {
            txtResult.Text = "0";
            operation = "";
        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            txtResult.Text = "0";
            labelResult.Text = "";
            value = 0;

        }

        private void operation_click(object sender, EventArgs e)
        {
            Button b = (Button)sender;
            total_value = Double.Parse(txtResult.Text);
            if (value != 0)
            {
                if (total_value == value)
                {
                    return;
                }
                equal.PerformClick();
                op = true;
                operation = b.Text;
                labelResult.Text = value + "" + operation;          
            }
            else
            {
                value = Double.Parse(txtResult.Text);
                op = true;
                operation = b.Text;                                                              
                labelResult.Text = value + "" + operation;
            }

            old_operation = b.Text;
        }

        private void btnEqu_Click(object sender, EventArgs e)
        {
            labelResult.Text = "";
            switch (operation)
            {
                case "+":
                    txtResult.Text = (value + Double.Parse(txtResult.Text)).ToString();
                    break;
                case "-":
                    txtResult.Text = (value - Double.Parse(txtResult.Text)).ToString();
                    break;
                case "*":
                    txtResult.Text = (value * Double.Parse(txtResult.Text)).ToString();
                    break;
                case "/":
                    txtResult.Text = (value / Double.Parse(txtResult.Text)).ToString();
                    break;
                default:
                    break;
            }
            value = Double.Parse(txtResult.Text);
            if (operation == "")
            {
                switch (old_operation)
                {
                    case "+":
                        txtResult.Text = (value + old_value).ToString();
                        break;
                    case "-":
                        txtResult.Text = (value - old_value).ToString();
                        break;
                    case "*":
                        txtResult.Text = (value * old_value).ToString();
                        break;
                    case "/":
                        txtResult.Text = (value / old_value).ToString();
                        break;
                    default:
                        break;
                }
             
            }
            operation = "";
        }

        private void btnDel_Click(object sender, EventArgs e)
        {
            if (txtResult.Text.Trim() != "0")
            {
                txtResult.Text = txtResult.Text.Substring(0, txtResult.Text.Length - 1);
                txtResult.Focus();

            }
        }

        private void labelResult_Click(object sender, EventArgs e)
        {
         
        }

        private void btnPercent_Click(object sender, EventArgs e)
        {
            Button b = (Button)sender;
            txtResult.Text = "0";
         
        }

        private void FunctionBtn_Click(object sender, EventArgs e)
        {
         
        }

        private void btnPercent_Click_1(object sender, EventArgs e)
        {
            btnEqu_Click(null, null);
            txtResult.Text = (value / 100).ToString();
        }

        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
       
        }

        private void txtResult_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar)
           && !char.IsDigit(e.KeyChar)
           && e.KeyChar != '.')
            {
                e.Handled = true;
            }
            if (e.KeyChar == '.' && (sender as TextBox).Text.IndexOf('.') > -1)
            {
                e.Handled = true;
            }
        }

        private void btnSqrt_Click(object sender, EventArgs e)
        {
            btnEqu_Click(null, null);
            value = Double.Parse(txtResult.Text);
            txtResult.Text = Math.Sqrt(value).ToString();
        }

        private void btnDivX_Click(object sender, EventArgs e)
        {
            btnEqu_Click(null, null);
            value = Double.Parse(txtResult.Text);
            txtResult.Text = (1 / value).ToString();
        }

        private void btnSqr_Click(object sender, EventArgs e)
        {
            btnEqu_Click(null, null);
            value = Double.Parse(txtResult.Text);
            txtResult.Text = (value * value).ToString();
        }

        private void btnAddSubstract_Click(object sender, EventArgs e)
        {
            if (txtResult.Text.StartsWith("-"))
            {
                //It's negative now, so strip the `-` sign to make it positive
                txtResult.Text = txtResult.Text.Substring(1);
            }
            else if (!string.IsNullOrEmpty(txtResult.Text) && decimal.Parse(txtResult.Text) != 0)
            {
                //It's positive now, so prefix the value with the `-` sign to make it negative
                txtResult.Text = "-" + txtResult.Text;
            }
        }

        private void factorial_Click(object sender, EventArgs e)
        {
            int numberInt = int.Parse(txtResult.Text);
            int result = numberInt;

            for (int i = 1; i < numberInt; i++)
            {
                result = result * i;
            }

            txtResult.Text = result.ToString();
        }
    }
}

===========================================================



Writing about My Neighborhood

[postlink] http://uknow-iknow.blogspot.com/2016/08/writing-about-my-neighborhood.html[/postlink]
              Hello my name is OUTDOM. Nowadays I live in Siem Reap, and study at USEA (University of South-East Asia). For second semester of first year, my teacher asked me to writing about my neighborhood area. In my neighborhood area there are many area such as Hospital, School, Sport Club, Police station, Pagoda...

              My school is East of my home and also very good place in there, because it so nice and it's fresh air place. My friends  and my neighbor usually in there on evening, because they're wanna get fresh weather for make their feel to better. However, in my school is good environment. In front of my house there is a police station. Near of police station there is a lake that have many person go to bathing in there everyday. Sometime they're get the water in there to use for their living. In the west of my house maybe 1km there is a pagoda. The way to pagoda is very difficult for go. So don't have many people go there. 
 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2012. Study Programming - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger