Home | 12 ஆம் வகுப்பு | 12வது கணினி அறிவியல் | செயற்கூறுகளைக் கொண்ட C++ நிரல்களை இயக்கும் பைத்தான் நிரல்
   Posted On :  18.08.2022 07:02 pm

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

செயற்கூறுகளைக் கொண்ட C++ நிரல்களை இயக்கும் பைத்தான் நிரல்

இப்பொழுது நீங்கள் செயற்கூறுகள் மற்றும் செயற்கூறு அழைப்புகள் கொண்ட C++ நிரலை இயக்க பைத்தான் Scriptஐ சோதிக்க போகிறீர்கள்.

செயற்கூறுகளைக் கொண்ட C++ நிரல்களை இயக்கும் பைத்தான் நிரல்

இப்பொழுது நீங்கள் செயற்கூறுகள் மற்றும் செயற்கூறு அழைப்புகள் கொண்ட C++ நிரலை இயக்க பைத்தான் Scriptஐ சோதிக்க போகிறீர்கள்.

 

எடுத்துக்காட்டு 14.10.1 - பயனர் வரையறுத்த செயற்கூறினைக் கொண்டு ஒரு எண்ணின் கனத்தினை கண்டறியும் C++ நிரலை எழுதுக.

#include <iostream>

using namespace std;

// Function declaration

int cube(int num);

int main()

{

int num;

int c;

cout<<"Enter any number: "<<endl;

cin>>num;

c = cube(num);

cout<<"Cube of" <<num<< " is "<<c;

return 0;

}

//Function to find cube of any number

int cube(int num)

{

return (num * num * num);

}

// Save this file as cube_file.cpp

#Now select FileNew in Notepad and type the Python program

# Save the File as fun.py

# Program that compiles and executes a .cpp file

# Python fun.py -i c:\pyprg\cube_file.cpp

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:])

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

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

Enter any number:

5

Cube of 5 is 125

12th Computer Science : Chapter 14 : Integrating Python with MySql and C++ : Importing C++ Programs In Python : Python program Executing C++ Program Containing Functions 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++ நிரல்களை இறக்கம் செய்தல்