HTML'e C++ kodu nasıl bağlanır?

sandmanx07

Picopat
Katılım
29 Nisan 2023
Mesajlar
124
Çözümler
1
Daha fazla  
Sistem Özellikleri
// XEON E3 1230 3.20 GHZ // 16 GB RAM // ZOTAC GTX 770 2 GB // 256 GB SSD 500-550MB // WINDOWS 10 PRO //
Cinsiyet
Erkek
Böyle bir HTML kodum var ama C++ kodum da var o çalışmıyor. Nasıl HTML'ye bağlarım?

HTML:
<!Doctype html>

<Html>

<Head>

 <Title>login form</title>

 <Style>

 Body {

 Font-family: Arial, sans-serif;

 Background-color: #f1F1F1;

 }

.Container {

 Width: 300px;

 Padding: 16px;

 Background-color: White;

 Margin: 0 Auto;

 Margin-top: 100px;

 Border: 1px Solid #ccc;

 }

 İnput[type=text], input[type=password] {

 Width: 100%;

 Padding: 12px 20px;

 Margin: 8px 0;

 Display: İnline-block;

 Border: 1px Solid #ccc;

 Box-sizing: Border-box;

 }

 Button {

 Background-color: #4caf50;

 Color: White;

 Padding: 14px 20px;

 Margin: 8px 0;

 Border: None;

 Cursor: Pointer;

 Width: 100%;

 }

 Button: Hover {

 Opacity: 0.8;

 }

 </Style>

</Head>

<Body>

 <Div class="container">

 <Label for="username"><b>username</b></label>

 <İnput type="text" placeholder="enter username" name="username" required>

 <Label for="password"><b>password</b></label>

 <İnput type="password" placeholder="enter password" name="password" required>

 <Button type="submit">login</button>

 </Div>

</Body>

</Html>

C kodu.

C++:
#include <iOStream>
#include <string>

int main() {

 Std: String username, password;

 Std: Cout << "username: ";

 Std: Cin >> username;

 Std: Cout << "password: ";

 Std: Cin >> password;

 İf (username == "admin" && password == "password") {

 Std: Cout << "login successful!\n";

 } Else {

 Std: Cout << "ınvalid username or password.\n";

 }

 Return 0;

}
 
Son düzenleyen: Moderatör:
Sanırım C++ kullanarak login işlemi yaptırmaya çalışıyorsun HTML'e ama mantıklı değil. Bu kadar basit bir kodla olmaz. Backend JS yada PHP dene.

C++'ta ısrarcıysan şunu incelemek isteyebilirsin, özellikle post kısmını; C++ Web Programming
 
Son düzenleme:
Hocam verdiğiniz 2 kod dizisinin birbiriyle bağlantısını anlayamadım, sitede birkaç tane buton ve girdi kutuları olduğunu görüyorum ancak sitenin herhangi bir biçimde C koduna bilgi gönderdiğini göremiyorum.
 
Böyle bir HTML kodum var ama C++ kodum da var o çalışmıyor. Nasıl HTML'ye bağlarım?

HTML:
<!Doctype html>

<Html>

<Head>

 <Title>login form</title>

 <Style>

 Body {

 Font-family: Arial, sans-serif;

 Background-color: #f1F1F1;

 }

.Container {

 Width: 300px;

 Padding: 16px;

 Background-color: White;

 Margin: 0 Auto;

 Margin-top: 100px;

 Border: 1px Solid #ccc;

 }

 İnput[type=text], input[type=password] {

 Width: 100%;

 Padding: 12px 20px;

 Margin: 8px 0;

 Display: İnline-block;

 Border: 1px Solid #ccc;

 Box-sizing: Border-box;

 }

 Button {

 Background-color: #4caf50;

 Color: White;

 Padding: 14px 20px;

 Margin: 8px 0;

 Border: None;

 Cursor: Pointer;

 Width: 100%;

 }

 Button: Hover {

 Opacity: 0.8;

 }

 </Style>

</Head>

<Body>

 <Div class="container">

 <Label for="username"><b>username</b></label>

 <İnput type="text" placeholder="enter username" name="username" required>

 <Label for="password"><b>password</b></label>

 <İnput type="password" placeholder="enter password" name="password" required>

 <Button type="submit">login</button>

 </Div>

</Body>

</Html>

C kodu.

C++:
#include <iOStream>
#include <string>

int main() {

 Std: String username, password;

 Std: Cout << "username: ";

 Std: Cin >> username;

 Std: Cout << "password: ";

 Std: Cin >> password;

 İf (username == "admin" && password == "password") {

 Std: Cout << "login successful!\n";

 } Else {

 Std: Cout << "ınvalid username or password.\n";

 }

 Return 0;

}
Hocam lütfen kullandığınız ide veya editörün formatter’ını kullanabilir misiniz? C++ böyle yazılmaz çünkü.

+ olarak bu kodlar birbirine bağlanamazlar.
 

Yeni konular

Geri
Yukarı