fork download
  1. <!DOCTYPE html>
  2. <html lang="th">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>ร้านขาย Nitro</title>
  7. <link rel="stylesheet" href="styles.css">
  8. </head>
  9. <body>
  10. <header>
  11. <h1>ร้านขาย Nitro</h1>
  12. <nav>
  13. <a href="index.html">หน้าแรก</a>
  14. <a href="login.html">เข้าสู่ระบบ</a>
  15. <a href="cart.html">รถเข็น</a>
  16. </nav>
  17. </header>
  18.  
  19. <section class="products">
  20. <h2>รายการ Nitro</h2>
  21. <div class="product">
  22. <img src="nitro1.png" alt="Nitro Basic">
  23. <h3>Nitro Basic</h3>
  24. <p>ราคา: 100 บาท</p>
  25. <button onclick="addToCart('Nitro Basic', 100)">เพิ่มลงรถเข็น</button>
  26. </div>
  27.  
  28. <div class="product">
  29. <img src="nitro2.png" alt="Nitro Boost">
  30. <h3>Nitro Boost</h3>
  31. <p>ราคา: 200 บาท</p>
  32. <button onclick="addToCart('Nitro Boost', 200)">เพิ่มลงรถเข็น</button>
  33. </div>
  34. </section>
  35.  
  36. <footer>
  37. <p>ร้านขาย Nitro © 2025</p>
  38. </footer>
  39.  
  40. <script src="script.js"></script>
  41. </body>
  42. </html>
  43.  
  44. body {
  45. font-family: Arial, sans-serif;
  46. background-color: #dff0ff;
  47. text-align: center;
  48. }
  49.  
  50. background-color: #0099ff;
  51. color: white;
  52. padding: 15px;
  53. }
  54.  
  55. nav a {
  56. color: white;
  57. text-decoration: none;
  58. margin: 0 15px;
  59. }
  60.  
  61. .products {
  62. display: flex;
  63. justify-content: center;
  64. margin-top: 20px;
  65. }
  66.  
  67. .product {
  68. background: white;
  69. padding: 15px;
  70. margin: 10px;
  71. border-radius: 10px;
  72. box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  73. }
  74.  
  75. button {
  76. background: #007bff;
  77. color: white;
  78. border: none;
  79. padding: 10px;
  80. cursor: pointer;
  81. }
  82.  
  83. button:hover {
  84. background: #0056b3;
  85. }
  86. <!DOCTYPE html>
  87. <html lang="th">
  88. <head>
  89. <meta charset="UTF-8">
  90. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  91. <title>รถเข็น</title>
  92. <link rel="stylesheet" href="styles.css">
  93. </head>
  94. <body>
  95. <header>
  96. <h1>รถเข็นของฉัน</h1>
  97. <nav>
  98. <a href="index.html">หน้าแรก</a>
  99. <a href="login.html">เข้าสู่ระบบ</a>
  100. </nav>
  101. </header>
  102.  
  103. <section>
  104. <h2>สินค้าที่เลือก</h2>
  105. <ul id="cart-list"></ul>
  106. <p>ยอดรวม: <span id="total-price">0</span> บาท</p>
  107. <button onclick="checkout()">ชำระเงิน</button>
  108. </section>
  109.  
  110. <script src="script.js"></script>
  111. </body>
  112. </html>
  113.  
  114. <!DOCTYPE html>
  115. <html lang="th">
  116. <head>
  117. <meta charset="UTF-8">
  118. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  119. <title>เข้าสู่ระบบ</title>
  120. <link rel="stylesheet" href="styles.css">
  121. </head>
  122. <body>
  123. <header>
  124. <h1>เข้าสู่ระบบ</h1>
  125. <nav>
  126. <a href="index.html">หน้าแรก</a>
  127. </nav>
  128. </header>
  129.  
  130. <section>
  131. <form id="login-form">
  132. <label for="username">ชื่อผู้ใช้:</label>
  133. <input type="text" id="username" required>
  134. <label for="password">รหัสผ่าน:</label>
  135. <input type="password" id="password" required>
  136. <button type="submit">เข้าสู่ระบบ</button>
  137. </form>
  138. </section>
  139.  
  140. <script>
  141. document.getElementById("login-form").addEventListener("submit", function(event) {
  142. event.preventDefault();
  143. alert("เข้าสู่ระบบสำเร็จ!");
  144. });
  145. </script>
  146. </body>
  147. </html>
  148.  
  149. let cart = [];
  150.  
  151. function addToCart(productName, price) {
  152. cart.push({ name: productName, price: price });
  153. localStorage.setItem("cart", JSON.stringify(cart));
  154. alert(productName + " ถูกเพิ่มลงในรถเข็น!");
  155. }
  156.  
  157. function loadCart() {
  158. let cartList = document.getElementById("cart-list");
  159. let totalPrice = document.getElementById("total-price");
  160.  
  161. cart = JSON.parse(localStorage.getItem("cart")) || [];
  162. cartList.innerHTML = "";
  163. let sum = 0;
  164.  
  165. cart.forEach((item, index) => {
  166. let li = document.createElement("li");
  167. li.textContent = `${item.name} - ${item.price} บาท`;
  168. cartList.appendChild(li);
  169. sum += item.price;
  170. });
  171.  
  172. totalPrice.textContent = sum;
  173. }
  174.  
  175. function checkout() {
  176. alert("ไปหน้าชำระเงิน!");
  177. }
  178.  
  179. if (document.getElementById("cart-list")) {
  180. loadCart();
  181. }
Success #stdin #stdout 0.03s 25600KB
stdin
Standard input is empty
stdout
#include <stdio.h>

int main(void)
{
int i, j;
long dec;  /* ให้รับค่าอินพุทแบบ Long Integer - เลขจำนวนเต็มแบบยาว */
int bit[32];  /* จองพื้นที่ในการเก็บข้อมูลเลขฐาน 2 ลงใน Array */

    clrscr();  /* เคลียร์หน้าจอ */
    printf("Decimal Number : ");  /* แจ้งผู้ใช้เพื่อเตรียมป้อนค่าเลขฐาน 10 */
    scanf("%ld", &dec);  /* ต้องใช้ ld เพราะ Input มันเป็นแบบ Long Integer */
    i = 0;  /* กำหนดค่าเริ่มต้นของ Array */
    /* ทำตามที่ได้ออกแบบโปรแกรมเอาไว้ ... ยังไงยังงั้นเลย 55555+ */
    do {
        bit[i++] = dec % 2;  /* การหารเอาเศษ เพื่อให้เป็นคำตอบ */

        /* การหารทั่วไป แต่ตัวแปร dec ของภาษา C มันเป็น Integer หรือ เลขจำนวนเต็ม */
        /* ดังนั้นมันจึงตัดเศษ (หรือทศนิยม) ทิ้งไปโดยอัตโนมัติ */
        dec = dec / 2;

    } while (dec > 0);  /* เงื่อนไขที่ทำจนกระทั่ง dec = 0 ก็ออกจากวังวนเงื่อนไข */

    /* การแสดงผลของการแปลงเลขฐาน 10 เป็นเลขฐาน 2*/
    /* j = i - 1 และให้ j ลดค่าลงทีละ 1 ... ก็คืออ่านข้อมูลถอยหลังกลับเท่านั้นเองครับ */
    /* เพราะตัวแปรแบบ Array ในภาษา C มันเก็บข้อมูลจากซ้ายไปขวา */
    /* ทำให้ LSB มันไปอยู่ทางซ้าย ส่วน MSB มันไปอยู่ทางขวา */
    for(j = i - 1; j >= 0; j--)
        printf("%d", bit[j]);

printf("\n");
return 0;

}