|
Draw graph in turbo C |
|
|
សរសេរដោយ Satya MAO
|
|
អង្គារ, 20 កក្កដា 2010 08:03 |
|
#include<conio.h> #include<stdio.h> void main() { clrscr(); int coca,fanta,pepsi; int y; printf("Enter the amount(case) of these products:\n"); printf("ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ\n"); //ចុច Alt + 205 printf("Coca Cola:");scanf("%d",&coca); printf("Fanta:");scanf("%d",&fanta); printf("Pepsi:"); scanf("%d",&pepsi); printf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ\n"); printf("Graphic:\n\n\n"); textcolor(BLUE); gotoxy(12,40); cprintf("COCA COLA"); if(coca==0) printf(""); else{
for(int c=1;c<=coca;c++) { gotoxy(15,40-c); cprintf("±±"); //ចុច Alt + 177 ពីរដង y=40-c; } gotoxy(15,y-1); cprintf("%d",coca); } textcolor(RED); gotoxy(24,40); cprintf("FANTA"); if(fanta==0) printf(""); else { for(int f=1;f<=fanta;f++) { gotoxy(25,40-f); cprintf("±±"); y=40-f; } gotoxy(24,y-1); cprintf(" %d\n",fanta); } textcolor(YELLOW); gotoxy(34,40); cprintf("PEPSI"); if(pepsi==0) printf(""); else { for(int p=1;p<=pepsi;p++) { gotoxy(35,40-p); cprintf("±±"); y=40-p; } gotoxy(34,y-1); cprintf(" %d",pepsi); } getch(); } -------------------------------------------------- ផ្ទាំងលទ្ធផល៖
|
|
LAST_UPDATED2 |
|
|
Calculator in Turbo C |
|
|
សរសេរដោយ Satya MAO
|
|
ព្រហស្បតិ, 10 មិថុនា 2010 09:32 |
#include <stdio.h> #include <conio.h> int main() { double number1 = 1.0; double number2 = 2.0; char operation = '+'; char answer = 0; printf("====CALCULATOR====="); a: printf("\n"); scanf("%lf",&number1);fflush(stdin); scanf("%c",&operation);fflush(stdin); scanf("%lf",&number2);
switch(operation) { case '+': printf("= %lf\n", number1 + number2); break;
case '-': printf("= %lf\n", number1 - number2); break;
case '*': printf("= %lf\n", number1 * number2); break;
case '/': if(number2 == 0) printf("\n\n\aDivision by zero error!\n"); else printf("= %lf\n", number1 / number2); break;
case '%': if((long)number2 == 0) printf("\n\n\aDivision by zero error!\n"); else printf("= %ld\n", (long)number1 % (long)number2); break;
default: printf("\n\n\aIllegal operation!\n"); } printf("one more operation?(y/n):"); answer=getch(); printf("%c",answer); if(answer=='y') goto a; getch(); }
|
|
Pseudocode for Binary Search Method in Sorting List (for VB2008) |
|
|
|
សរសេរដោយ Setha IECH
|
|
អង្គារ, 25 ឧសភា 2010 11:02 |
Declare search_value As String Declare n As Integer Input n Declare list(1 to n) As String Input search_value Declare i As Integer For i=0 to n-1 Increased by 1 Input list(i) End For Declare start_index As Integer Declare end_index As Integer Declare mid_index As Integer Declare found_index As Integer Set found_index = -1 Set start_index=1 Set end_index=n Do mid_index = (Round Down) (start_index+end_index)/2 If end_index<=start_index Then If search_value = list(mid_index) Then found_index = mid_index End If Exit Do Else If search_value = list(mid_index) Then found_index = mid_index Exit Do Else If search_value < list(mid_index) Then end_index = mid_index – 1 Else start_index = mid_index + 1 End If End If End Do Loop If found_index = -1 Then Display “Search not found!” End If Output found_index |
|
Pseudocode for N-Variable System Linear Equation (for VB2008) |
|
|
|
សរសេរដោយ Setha IECH
|
|
អាទិត្យ, 23 ឧសភា 2010 13:54 |
- Identify Output
x1, x2, x3, ………, xn - Determine Input
b1, b2, b3, ………, bn a11, a12, a13, ………., a1n a21, a22, a23, ………., a2n ……………… an1, an2, an3, ………., ann - Determine Process
Declare n as Integer Input value of n Declare a(1 to n,1 to n), b(1 to n), DetD, DetDx(1 to n), x(1 to n) As Double Declare temp(1 to n) As Double Declare i, j As Integer For i=1 to n increased by 1 For j=1 to n increased by 1 input value of a(i, j) End For input value of b(i) End for DetD = CalculateDet (n, a) For i=1 to n increased by 1 For j=1 to n increased by 1 temp (j) = a (j, i) a(j, i) = b(j) End For DetDx(i) = CalculateDet (n , a) If DetD=0 Then If DetDx(i)=0 then Display Message “Infinite root!” Else Display Message “No root!” End If Exit For End If
x(i) = DetDx(i)/DetD Display x(i)
For j=1 to n increased by 1 a(j, i) = temp (j) End for End of For Function CalculateDet - Function CalculateDet
Parameters pass in: n and a(1 to n, 1 to n) Declare Det As Integer If n = 2 Then Det = a(1, 1) * a(2, 2) – a(2, 1) * a(1, 2) Else Declare temp(1 to n-1, 1 to n-1) As Double Declare Coef, m, k, j, i As Integer Det = 0 For i = 1 to n increased by 1 For j=2 to n increased by 1 m = 1 For k=1 to n increased by 1 If k ! = i Then temp(m, j-1) = a(k, j) m = m + 1 End If End For End For
If i modulus 2 = 0 Then Coef = -1 Else Coef = 1 End If Det = Det + Coef * a(i, 1) * CalculateDet (n-1, temp) End For End If Return Value of Det End Function
|
|
Export Data from VB 2008 to Excel |
|
|
|
សរសេរដោយ Setha IECH
|
|
ពុធ, 19 ឧសភា 2010 08:41 |
|
Private Sub btnExcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExcel.Click Dim ExcelApp As Object, ExcelBook As Object Dim ExcelSheet As Object Dim i As Integer Dim j As Integer 'create object of excel ExcelApp = CreateObject("Excel.Application") ExcelBook = ExcelApp.WorkBooks.Add ExcelSheet = ExcelBook.WorkSheets(1) With ExcelSheet For i = 1 To Me.DataGridView1.RowCount .cells(i, 1) = Me.DataGridView1.Rows(i - 1).Cells("id").Value For j = 1 To DataGridView1.Columns.Count - 1 .cells(i, j + 1) = DataGridView1.Rows(i - 1).Cells(j).Value Next Next End With ExcelApp.Visible = True 'set page margin ExcelSheet.PageSetup.PaperSize = 9 ExcelSheet.PageSetup.LeftMargin = ExcelApp.InchesToPoints(0.3) ExcelSheet.PageSetup.RightMargin = ExcelApp.InchesToPoints(0.3) ExcelSheet.PageSetup.TopMargin = ExcelApp.InchesToPoints(0.3) ExcelSheet.PageSetup.BottomMargin = ExcelApp.InchesToPoints(0.3) ExcelSheet.PageSetup.CenterHorizontally = True ' ExcelSheet = Nothing ExcelBook = Nothing ExcelApp = Nothing
End Sub Download Source Code Here |
|
|
|
|
|
|
ទំព័រ 1 នៃ 5 |