Home | 11 ஆம் வகுப்பு | 11வது கணினி அறிவியல் | எடுத்துக்காட்டு நிரல்கள் : அணிகள் மற்றும் கட்டுருக்கள்

கணினி அறிவியல் - எடுத்துக்காட்டு நிரல்கள் : அணிகள் மற்றும் கட்டுருக்கள் | 11th Computer Science : Chapter 12 : Arrays and Structures

   Posted On :  12.11.2022 07:09 pm

11வது கணினி அறிவியல் : அலகு 12 : அணிகள் மற்றும் கட்டுருக்கள்

எடுத்துக்காட்டு நிரல்கள் : அணிகள் மற்றும் கட்டுருக்கள்

கணினி அறிவியல் : அணிகள் மற்றும் கட்டுருக்கள் : எடுத்துக்காட்டு நிரல்கள் : அணிகள் மற்றும் கட்டுருக்கள்

ஒரு பரிமாண அணி


நிரல் இயக்க நேரத்தில் மதிப்புகளை உள்ளீடாக பெறுதல்

#include <iostream>

using namespace std;

int main()

{

      int num[5];

      for(int i=0; i<5; i++)

      {

           cout<< "\n Enter value " << i+1 << "= ";

           cin>>num[i];

      }

}


அணியின் உறுப்புகளை அணுகுதல்

#include <iostream>

using namespace std;

int main()

{

      int num[5] = {10, 20, 30, 40, 50};

      int t=2;

      cout<<num[2] <<endl; // S1

      cout<<num[3+1] <<endl; // S2

      cout<<num[t=t+1]; // S3

}

output:

30

50

40


C++ மொழியில் 10 மதிப்புகளை உள்ளீடாக பெற்று அதில் ஒற்றை எண்களின் எண்ணிக்கை (odd numbers) மற்றும் இரட்டை எண்களின் எண்ணிக்கையை ( Even numbers) காண்பதற்கான நிரல்.

#include <iostream>

using namespace std;

int main()

{

      int age[4];//declaration of array

      cout<< "Enter the age of four persons:" <<endl;

      for(int i = 0; i < 4; i++)//loop to write array elements

      cin>> age[i];

      cout<<"The ages of four persons are:";

      for(int j = 0; j< 4; j++)

           cout<< age[j]<<endl;

}

வெளியீடு:

Enter Number 1= 78 

Enter Number 2= 51 

Enter Number 3= 32

Enter Number 4= 66

Enter Number 5= 41 

Enter Number 6= 68

Enter Number 7= 27 

Enter Number 8= 65 

Enter Number 9= 28 

Enter Number 10= 94

There are 6 Even Numbers

There are 4 Odd Numbers


நேரியல் தேடலுக்கான நிரல் 

#include <iostream> 

using namespace std; 

int main()

{

  int num[10], val, id=-1; 

  for (int i=0; i<10; i++)

  {

  cout<< "\n Enter value" <<i+1 <<"="'; 

  cin>>num[i];

  }

  cout<< "\n Enter a value to be searched: '';

  cin>>val; 

for (int i=0; i<size; i++)

{

  if (arr[i] == value) 

   { id=i;

     break;

   }

}

  if(id==-1) 

  cout<< "\n Given value is not found in the array.."; 

  else 

  cout<< "\n The value is found at the position" << id+1; 

  return 0;

}


குறியுரு அணியை விளக்கும் நிரல்

#include <iostream> 

using namespace std; 

int main()

{

char country[6];

      cout<< "Enter the name of the country: ''; 

      cin>>country; 

      cout<<" The name of the country is "<<country;

}

வெளியீடு: 

Enter country the name: INDIA

The country name is INDIA


கொடுக்கப்படும் சொல்லானது palindrome சொல்லா என சோதிக்க C++ நிரல் எழுதுதல்.

#include<iostream>

using namespace std;

int main( )

{

      int i, j, len, flag =1;

      char a [20];

      cout<<"Enter a string:";

      cin>>a;

      for(len=0;a[len]!='\0';++len)

for(!=0,j=len-1;i<len/2;++i,--j)

      {

      if(a[j]!=a[i])

           flag=0;

      }

      if(flag==1)

           cout<<"\n The String is palindrome";

      else

           cout<<"\n The String is not palindrome";

      return 0;

}

வெளியீடு:

Enter a string : madam

The String is palindrome


இரு பரிமாண அணி


இரண்டு அணிகளை கூட்டுவதற்கான சி++ நிரல் எழுதுதல்

#include<iostream> 

#include<conio.h> 

using namespace std; 

int main()

{

int row, col, m1[10][10], m2[10][10], 

sum[10][10]; cout<<"Enter the number of rows :"; 

cin>>row; 

cout<<"Enter the number of columns : "; 

cin>>col; 

cout<< "Enter the elements of first 1st matrix: "<<endl; 

for (int i = 0;i<row;i++) { 

for (int j = 0;j <col;j++) { 

cin>>ml[i][j];

}

}

cout<< "Enter the elements of second 2nd matrix: "<<endl; 

for (int i = 0;i<row;i++) { 

for (int j = 0;j <col;j++) { 

cin>>m2[i][j];

}

}

cout<< "Enter the elements of second 2nd matrix: "<<endl; 

for (int i = 0;i<row;i++) { 

for (int j = 0;j<col;j++){

cin>>m2[i][j];

}

}

cout<<"Output: "<<endl; 

for (int i = 0;i<row;i++) { 

for (int j = 0;j<col;j++)

{

sum[i][j]=ml[i][j]+m2[i][j]; 

cout<<sum[i][j]<<" ";

}

cout<<endl<<endl;

}

getch(); 

return 0;

}


சரங்களின் அணி


இரு பரிமாண குறியுரு அணியை பயன்படுத்தி சரங்களின் அணியை சேமித்தல் 

#include<iostream>

using namespace std;

int main( )

{

      // initialize 2d array

      char colour [4][10]={"Blue","Red","Orange", "yellow"};

      // printing strings stored in 2d array

      for (int i=0; i <4; i++)

      cout << colour [i] << "\n";

}

Output:

Blue

Red

Orange

Yellow


கட்டுருக்கள்


பின்வரும் c++ நிரல் மாணவர்களின் தகவல்களை உள்ளீடாக விசைப்பலகையின் மூலம் பெற்று மற்றும் அதைத் திரையில் காட்டுகிறது.

#include <iostream>

using namespace std;

struct Student

{

      int age;

      float height, weight;

} mahesh; void main( )

{

      cout<< “ Enter the age:”<<endl;

      cin>>mahesh.age;

      cout<< “Enter the height:”<<endl;

      cin>>mahesh.height;

      cout<< “Enter the weight:”<<endl;

      cin>>mahesh.weight;

      cout<< “The values entered for Age, height and weight are”<<endl;

      cout<<mahesh.age<< “\t”<<mahesh.height<< “\t”<<Mahesh. weight;

}

வெளியீடு:

Enter the age:

18

Enter the height:

160.5

Enter the weight:

46.5

The values entered for Age, height and weight are

18  160.5    46.5




Tags : Computer Science கணினி அறிவியல்.
11th Computer Science : Chapter 12 : Arrays and Structures : Example C++ Programs: Arrays and Structures Computer Science in Tamil : 11th Standard TN Tamil Medium School Samacheer Book Back Questions and answers, Important Question with Answer. 11வது கணினி அறிவியல் : அலகு 12 : அணிகள் மற்றும் கட்டுருக்கள் : எடுத்துக்காட்டு நிரல்கள் : அணிகள் மற்றும் கட்டுருக்கள் - கணினி அறிவியல் : 11 ஆம் வகுப்பு தமிழ்நாடு பள்ளி சமசீர் புத்தகம் கேள்விகள் மற்றும் பதில்கள்.
11வது கணினி அறிவியல் : அலகு 12 : அணிகள் மற்றும் கட்டுருக்கள்