Home | 12 ஆம் வகுப்பு | 12வது கணினி அறிவியல் | பைத்தான் எவ்வாறு C++ நிரல்களின் பிழைகளைக் கையாள்கிறது
   Posted On :  18.08.2022 06:50 pm

12 வது கணினி அறிவியல் : அலகு 14 : MySql மற்றும் C++ உடன் பைத்தானை ஒருங்கிணைத்தல் : பைத்தானில் C++ நிரல்களை இறக்கம் செய்தல்

பைத்தான் எவ்வாறு C++ நிரல்களின் பிழைகளைக் கையாள்கிறது

பைத்தான் வெற்றிகரமான C++ நிரலை இயக்குவது மட்டுமல்லாது, தொகுத்தலின் போது C++ கூற்றில் ஏதேனும் பிழைகள் இருப்பின் அவற்றை வெளியிடவும் உதவுகிறது.

பைத்தான் எவ்வாறு C++ நிரல்களின் பிழைகளைக் கையாள்கிறது

பைத்தான் வெற்றிகரமான C++ நிரலை இயக்குவது மட்டுமல்லாது, தொகுத்தலின் போது C++ கூற்றில் ஏதேனும் பிழைகள் இருப்பின் அவற்றை வெளியிடவும் உதவுகிறது. உதாரணத்திற்கு, கீழ்க்காணும் C++ நிரலின் ஒரு பிழை உள்ளது. பைத்தான் மூலம் தொகுக்கும் போது என்ன நேரும் என்பதைப் பார்க்கலாம்.

 

எடுத்துக்காட்டு 14.8.1

// C++ program to print the message Hello

//Now select File>New in Notepad and type the C++ program

#include<iostream>

using namespace std;

int main()

{

std::cout<<"hello"

return 0;

}

// Save this file as hello.cpp

 

#Now select File ->New in Notepad and type the Python program as main.py

# Program that compiles and executes a .cpp file

# Python main.py -i hello

import sys, os, getopt

def main(argv):

opts, args = getopt.getopt(argv, "i:")

for o, a in opts:

if o in "-i":

run(a)

def run(a):

inp_file=a+'.cpp'

exe_file=a+'.exe')

os.system('g++ ' + inp_file + ' -o ' + exe_file)

Os.system(exe_file)

if_name_=='_main_':

main(sys.argv[1:])

மேற்கண்ட நிரலின் வெளியீடு

C:\Users\Dell>python c:\pyprg\main.py -i c:\pyprg\ch14\hello

c:\pyprg\hello.cpp: In function 'int main()':

c:\pyprg\hello.cpp:6:21: error: expected';' before 'return'

std::cout<<"hello"

˄

;

return 0;

--------------------------

'c:\pyprg\hello.exe' is not recognized as an internal or external command, operable program or batch file.

குறிப்பு

மேற்கண்ட நிரலில், பைத்தான் உள்ள பிழைகளை வெளிக்காட்ட உதவுகிறது. பிழைகள் அவற்றின் வரிசை எண்களுடன் வெளியிடப்படுகின்றன. அவற்றின் வரிசை எண், பைத்தான் scriptலிருந்து தொடங்குகிறது.

12th Computer Science : Chapter 14 : Integrating Python with MySql and C++ : Importing C++ Programs In Python : How Python is handling the errors in C++ in Tamil : 12th Standard TN Tamil Medium School Samacheer Book Back Questions and answers, Important Question with Answer. 12 வது கணினி அறிவியல் : அலகு 14 : MySql மற்றும் C++ உடன் பைத்தானை ஒருங்கிணைத்தல் : பைத்தானில் C++ நிரல்களை இறக்கம் செய்தல் : பைத்தான் எவ்வாறு C++ நிரல்களின் பிழைகளைக் கையாள்கிறது - : 12 ஆம் வகுப்பு தமிழ்நாடு பள்ளி சமசீர் புத்தகம் கேள்விகள் மற்றும் பதில்கள்.
12 வது கணினி அறிவியல் : அலகு 14 : MySql மற்றும் C++ உடன் பைத்தானை ஒருங்கிணைத்தல் : பைத்தானில் C++ நிரல்களை இறக்கம் செய்தல்