Thursday 6 October 2016

.........

 Why use neural networks?

Neural networks, with their remarkable ability to derive meaning from complicated or imprecise data, can be used to extract patterns and detect trends that are too complex to be noticed by either humans or other computer techniques.
 A trained neural network can be thought of as an "expert" in the category of information it has been given to analyse. 
This expert can then be used to provide projections given new situations of interest and answer "what if" questions.

Other advantages include:

1.     Adaptive learning: An ability to learn how to do tasks based on the data given for training or initial experience.
2.     Self-Organisation: An ANN can create its own organisation or representation of the information it receives during learning time.
3.     Real Time Operation: ANN computations may be carried out in parallel, and special hardware devices are being designed and manufactured which take advantage of this capability.

4.     Fault Tolerance via Redundant Information Coding: Partial destruction of a network leads to the corresponding degradation of performance. However, some network capabilities may be retained even with major network damage.

 What is a Neural Network?


                                                                        An Artificial Neural Network (ANN) is an information processing paradigm that is inspired by the way biological nervous systems, such as the brain, process information. The key element of this paradigm is the novel structure of the information processing system. It is composed of a large number of highly interconnected processing elements (neurones) working in unison to solve specific problems. ANNs, like people, learn by example. An ANN is configured for a specific application, such as pattern recognition or data classification, through a learning process. Learning in biological systems involves adjustments to the synaptic connections that exist between the neurones. This is true of ANNs as well.

Saturday 9 July 2016

Create a class called shipthat incorporates a ship’s number and location. Use the
approach of Exercise 8 to number each shipobject as it is created. Use two variables of
theangleclass from Exercise 7 to represent the ship’s latitude and longitude. A member
function of the shipclass should get a position from the user and store it in the object;
another should report the serial number and position. Write a main()program that creates three ships, asks the user to input the position of each, and then displays each ship’s
number and position...


#include<iostream>
#include<conio.h>

using namespace std;

class ship{
private:
int serial;
static int num;
int degrees;
float minutes;
char direction;
public:
ship(){
num++;
serial = num;
}
void getLoc(){
cout << "Enter Degrees: "; cin >> degrees;
cout << "Enter Minutes: "; cin >> minutes;
cout << "Enter Direction: "; cin >> direction;
}
void reportSerLoc(){
cout << "Ship Number " << serial << " Is At " << degrees << '\xF8' << minutes << "\'" << direction << endl;
}
};
int ship::num=0;

int main(){
ship s1,s2,s3;
cout << "Enter Location Of 1st Ship" << endl;
s1.getLoc();
cout << "Enter Location Of 2nd Ship" << endl;
s2.getLoc();
cout << "Enter Location Of 3rd Ship" << endl;
s3.getLoc();
s1.reportSerLoc();
s2.reportSerLoc();
s3.reportSerLoc();
}

ADD Any Two Number.......... 

#include <iostream>
#include <conio.h>
using namespace std;
class Int{
private:
int intvar;
public:
Int(){
intvar = 0;
}
Int(int x){
intvar = x;
}
void display(){
cout << intvar << endl;
}
void add(Int x, Int y){
intvar = x.intvar + y.intvar;
}
};
int main(){
Int a(5),b(45);
Int c;
c.add(a,b);
c.display();
}

Repeat Again any Sentence/Paraghraph........ 

#include <iostream>
#include <conio.h>
using namespace std;
class count{
private:
int serial;
static int num;
public:
count(){
num++;
serial=num;
}
void reportSerial(){
cout<<"I'm Object Number "<< serial << endl;
}
};
int count::num=0;
int main(){
count f1,f2,f3;
f1.reportSerial();
f2.reportSerial();
f3.reportSerial();
}

Thursday 7 July 2016

Transform the fraction structure from Exercise 8 in Chapter 4 into a fraction class. Member data is the fraction’s numerator and denominator. Member functions should accept input from the user in the form 3/5, and output the fraction’s value in the same format. Another member function should add two fraction values. 

Write a main() program that allows the user to repeatedly input two fractions and then displays their sum. After each operation, ask whether the user wants to continue....


#include<iostream>
#include<conio.h>
using namespace std;

class fraction{
private:
int numerator, denominator;
char c;
void dispFct()
{
cout<<numerator<<"/"<<denominator;
}
public:
void getFct(){
cout<<"Enter fraction: "; cin>>numerator>>c>>denominator;
}
void addFct(fraction x, fraction y){
numerator=x.numerator*y.denominator+x.denominator*y.numerator;
denominator=x.denominator*y.denominator;
+cout<<"Sum = "; dispFct();
}
};

int main()
{
fraction f1,f2,f3;

f1.getFct();
f2.getFct();
f3.addFct(f1, f2);
}

Create a class that includes a data member that holds a “serial number” for each object created from the class. That is, the first object created will be numbered 1, the second 2, and so on. To do this,you’ll need another data member that records a count of how many objects have been created so far. (This member should apply to the class as a whole; not to individual objects. 

What keyword specifies this?) Then, as each object is created, its constructor can examine this count member variable to determine the appropriate serial number for the new object. Add a member function that permits an object to report its own serial number. Then write a main() program that creates three objects and queries each one about its serial number. They should respond I am object number 2,and so on.


#include <iostream>
#include <conio.h>
using namespace std;
class count{
private:
int serial;
static int num;
public:
count(){
num++;
serial=num;
}
void reportSerial(){
cout<<"I'm Object Number "<< serial << endl;
}
};
int count::num=0;

int main(){
count f1,f2,f3;
f1.reportSerial();
f2.reportSerial();
f3.reportSerial();
}

In ocean navigation, locations are measured in degrees and minutes of latitude and longitude. Thus if you’re lying off the mouth of Papeete Harbor in Tahiti, your location is 149 degrees 34.8 minutes west longitude, and 17 degrees 31.5 minutes south latitude. This is

written as 149°34.8’ W, 17°31.5’ S. There are 60 minutes in a degree. (An older system also divided a minute into 60 seconds, but the modern approach is to use decimal minutes instead.) Longitude is measured from 0 to 180 degrees, east or west from Greenwich, England, to the international dateline in the Pacific. Latitude is measured from 0 to 90 degrees, north or south from the equator to the poles. 
Create a class angle that includes three member variables: an int for degrees, a float for minutes, and a char for the direction letter (N, S, E, or W). This class can hold either a latitude variable or a longitude variable. Write one member function to obtain an angle value (in degrees and minutes) and a direction from the user,and a second to display the angle value in 179°59.9’ E format. Also write a three-argument constructor.
 Write a main() program that displays an angle initialized with the constructor, and then, within a loop, allows the user to input any angle value, and then displays the value. You can use the hex character constant ‘\xF8’, which usually prints a degree (°) symbol..


#include<iostream>
#include<conio.h>

using namespace std;

class angle{
private:
int degrees;
float minutes;
char direction;
public:
angle(int deg, float min, char dir){
degrees=deg;
minutes=min;
direction=dir;
}
void getAngle(int deg, float min, char dir){
degrees=deg;
minutes=min;
if(dir>96 && dir<124)
direction=dir-32;
else
direction=dir;
}
void disp() const {
cout << degrees << "\xF8" << minutes << "\'" << direction << endl;
}
};

int main(){
angle A(17, 31.5f, 'S');
int a; float b; char c;
A.disp();
cout<<"Enter degrees  : ";
cin>>a;
cout<<"Enter minutes  : ";
cin>>b;
cout<<"Enter direction: ";
cin>>c;
A.getAngle(a, b, c);
A.disp();
}


Start with the date structure  and transform it into a date class. Its member data should consist of three ints: month, day, and year. It should also have two member functions: getdate(), which allows the user to enter a date in 12/31/02 format, and showdate(), which displays the date.

#include<iostream>
#include<conio.h>

using namespace std;

class date{
private:
int month, day, year;
char c;
public:
void setDate(){
cout << "Enter Date In This Format 31/12/1999" << endl;
cin >> day>>c>>month>>c>>year;
}
void getDate(){
cout << "Date Entered Is" << endl;
cout << day << c << month << c << year << endl;
}
};

int main(){
date d1;
d1.setDate();
d1.getDate();
}

Create an employee class . The member data should comprise an int for storing the employee number and a float for storing the employee’s compensation. Member functions should allow the user to enter this data and display it. 

Write a main() that allows the user to enter data for three employees and display it.

#include <iostream>
#include <conio.h>

using namespace std;

class employee{
private:
int emp_num;
float emp_comp;
public:
void entData(){
cout << "Enter Employee\'s Number ";
cin >> emp_num;
cout << "Enter Employee\'s Salary " ;
cin >> emp_comp;
}
void display(){
cout << "Employee\'s Number " << emp_num << endl;
cout << "Enployee\'s Salary " << emp_comp << endl;
}
};

int main(){
employee emp1, emp2, emp3;
cout << "Enter Data For Employee 1" << endl;
emp1.entData();
cout << "Enter Data For Employee 2" << endl;
emp2.entData();
cout << "Enter Data For Employee 3" << endl;
emp3.entData();
cout << "Total Data Entered Is" << endl;
emp1.display();
emp2.display();
emp3.display();
}

Wednesday 6 July 2016

Create a class called time that has separate int member data for hours, minutes, and seconds. One constructor should initialize this data to 0, and another should initialize it to fixed values. 

Another member function should display it, in 11:59:59 format. The final member function should add two objects of type time passed as arguments. 

A main() program should create two initialized time objects (should they be const?) and one that isn’t initialized. Then it should add the two initialized values together, leaving the result in the third time variable. 

Finally it should display the value of this third variable. Make appropriate member functions const....


#include <iostream>
#include <conio.h>

using namespace std;

class time{
private:
int hours,minutes,seconds;
public:
time(){
hours = minutes = seconds = 0;
}
time(int h, int m, int s){
hours = h;
minutes = m;
seconds = s;
}
void showTime() const {
cout << hours << ':' << minutes << ':' << seconds;
}
void addTime(time x, time y){
seconds = x.seconds + y.seconds;
if(seconds>59){
seconds-=60;
minutes++;
}
minutes += x.minutes + y.minutes;
if(minutes>59){
minutes-=60;
hours++;
}
hours+=x.hours+y.hours;
}
};

int main(){
const time a(2,23,45), b(4,25,15);
time c;
c.addTime(a,b);
c.showTime();
}

Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay a 50 cent toll. Mostly they do, but sometimes a car goes by without paying. The tollbooth keeps track of the number of cars that have gone by, and of the total amount of money collected.
Model this tollbooth with a class called tollBooth. The two data items are a type unsigned int to hold the total number of cars, and a type double to hold the total amount of money collected.
A constructor initializes both of these to 0. A member function called payingCar() increments the car total and adds 0.50 to the cash total.
Another function, called nopayCar(),increments the car total but adds nothing to the cash total. Finally,a member function called display() displays the two totals. Make appropriate member functions const......


#include <iostream>
#include <conio.h>

using namespace std;

char getWhatTheyWant();

class tollBooth{
private:
unsigned int numCars;
double amount;
public:
tollBooth(){
numCars = 0;
amount = 0;
}
void payingCar(){
numCars++;
amount+=0.50;
}
void noPayCar(){
numCars++;
}
void display() {
cout << "Number Of Total Cars: " << numCars << endl;
cout << "Total Amount: " << amount << endl;
}
};

int main(){
tollBooth booth;
char whatTheyWant;
whatTheyWant = getWhatTheyWant();
while(whatTheyWant!='s'){
switch(whatTheyWant){
case('p'):
cout << "Paid" << endl << endl;
booth.payingCar();
whatTheyWant = getWhatTheyWant();
break;
case('n'):
cout << "Not Paid" << endl << endl;
booth.noPayCar();
whatTheyWant = getWhatTheyWant();
break;
case('s'):
cout << "Result" << endl << endl;
break;
default:
cout << "Invalid Input" << endl;
}
}
booth.display();
}

char getWhatTheyWant(){
char a;
cout << "Enter 'p' To Pay And Pass" << endl;
cout << "Enter 'n' To Pass Without Paying" << endl;
cout << "Press 's' To Show Result And Exit" << endl;
cout << "Make Your Choice" << endl;
a = getch();
return a;
}












Create a class that imitates part of the functionality of the basic data type int. Call the class Int (note different capitalization). The only data in this class is an int variable. Include member functions to initialize an Int to 0, to initialize it to an int value,to display it (it looks just like an int), and to add two Int values. Write a program that exercises this class by creating one uninitialized and two initialized Int values,adding the two initialized values and placing the response in the uninitialized value,and then displaying this result.

#include <iostream>
#include <conio.h>
using namespace std;
class Int{
private:
int intvar;
public:
Int(){
intvar = 0;
}
Int(int x){
intvar = x;
}
void display(){
cout << intvar << endl;
}
void add(Int x, Int y){
intvar = x.intvar + y.intvar;
}
};
int main(){
Int a(5),b(45);
Int c;
c.add(a,b);
c.display();
}

ASCII VALUE.................

#include<stdio.h>
#include<conio.h>
int main()
{
char a;
printf("plz enter the character");
scanf("%c",&a);
if(a>=65&&a<=90)
       printf("you entered a captical letter");
if(a>=97&&a<=122)
       printf("you entered a small letter");
if(a>=47&&a<=58)
       printf("you entered a digit");
if((a>=0 && a<=47) ||( a>=58 && a<=64) ||(a>=91 && a<=96) ||( a>=123 && a<=127));
       printf("you entered a special symbol");

getch();
}

Show the Reasult of Star Cube............


#include<stdio.h>
#include<conio.h>

int  main()

{
 int a,b,n;
printf("enter n");
scanf("%d",&n);
for(a=1;a<=n;a++)
   {
      for(b=1;b<=n;b++)
          if(a==1)
       printf("*");
           else if(b==1)
       printf("*");
             else if(a==n)
       printf("*");
             else if(b==n)
       printf("*");
 else
       printf(" ");
       printf("\n");
}
getch();
}

                                              ***************
                     *                          *                       *                          *                       *                          *                     *                          *                      *                          *                     *                          *                        *                          *                     *************** 


 




Tuesday 5 July 2016


#include<stdio.h>
#include<conio.h>
void main()
{
int days;
printf("Enter The Number Of Days You Are Late To Submit The Book ");
scanf("%d",&days);
if(days<=5)
printf("Your Fine Is 50 Paisa.");
else if(days>=6&&days<=10)
printf("Your Fine Is 1 Rupee.");
if(days>30)
printf("Your Membership Is Cancelled.");


getch();
clrscr();
}

Tuesday 28 June 2016

Give Information And Check Premium..........

#include<stdio.h>
#include<conio.h>
void main()
{
int age;
char h,a,g;
printf("Enter Your Age ");
scanf("%d",&age);
printf("Enter m For Male, f For Female ");
scanf(" %c",&g);
printf("Enter c For City, v For Village ");
scanf(" %c",&a);
printf("Enter e For Excellent Health, p For Poor Health ");
scanf(" %c",&h);
if(age>24&&age<36&&g=='m'&&a=='c'&&h=='e')
printf("Your Premium Is Rs.4/1000 And Cannot Exceed Rs.2Lakh.");
else if(age>24&&age<36&&g=='f'&&a=='c'&&h=='e')
printf("Your Premium Is Rs.3/1000 And Cannot Exceed Rs.1Lakh.");
else if(age>24&&age<36&&g=='m'&&a=='v')
printf("Your Premium Is Rs. 6/1000 And Cannot Exceed Rs.1000.");
else
printf("You Are Not Insured.");
getch();
clrscr();
}

         Person Inshured for Take Money 


#include<stdio.h>
#include<conio.h>
void main()
{
       int age;
       char ms,g;
                 printf("Enter Your Age ");
                 scanf("%d",&age);
printf("Enter m For Married And u For Unmarried ");
              scanf(" %c",&ms);
printf("Enter m For Male, f For Female ");
              scanf(" %c",&g);
     if(ms=='m')
          printf("You Are Insured.");
     else if(ms=='u'&&g=='m'&&age>30)
            printf("You Are Insured");
      else if(ms=='u'&&g=='f'&&age>25)
              printf("You Are Insured");
else
 printf("You Are Not Insured");

  getch();
  clrscr();
}

Monday 27 June 2016

                  Leap Year Or NOt.........


#include<stdio.h>
#include<conio.h>
void main()
{
    int y;
        printf("Enter Any Year");
                   scanf("%d",&y);
if(y%400==0||(y%100!=0&&y%4==0))
                          printf("Leap Year");


                          else
                         printf("Not A Leap Year");
getch();
clrscr();
}

#include<stdio.h>
#include<conio.h>
void main()
{
int days;
clrscr();
printf("Enter the Number of the day the member is late to return the book");
scanf("%d",&days);
if(days<=5)
printf("\nYou must pay 50 paisa fine");
else if(days>=6 && days<=10)
printf("\nYou must pay 1 rupee fine");
else if (days>10 && days<30)
printf("\nYou must pay 5 rupee fine");
else if(days>=30)
printf("\nYour Membership is Cancelled");

getch();
}