Do-While Program in C/C++ to print all even numbers from 1-50 This is a Do-While Program in C/C++ to print all even numbers from 1-50. #include<iostream> #include<conio.h> #include<math.h> using namespace std; int main() { int num=0; do{ cout << num << "\t"; num=num+2; } while(num<=50); }
Classes and Functions in OOP (Object Oriented Programming) In object-oriented programming , a class is a template definition of the methods and variable s in a particular kind of object . Thus, an object is a specific instance of a class; it contains real values instead of variables. The class is one of the defining ideas of object-oriented programming. Among the important ideas about classes are: A class can have subclasses that can inherit all or some of the characteristics of the class. In relation to each subclass, the class becomes the superclass Subclasses can also define their own methods and variables that are not part of their superclass. The structure of a class and its subclasses is called the class hierarchy. A Simple Program defining Classes using OOP (Object Oriented Programming) is given below in which i have made a class named Student : #include<iostream> using namespace std; ...
A small airline has just purchased a computer for its new automated reservations system. You’ve been asked to program the new system. You are to write a program to assign seats on each flight of the air line ’s only plane (capacity: 10 seats). #include<iostream> using namespace std; int option_select(); bool availibility_checking(int); void reserve_boarding(int); void next_flight(); int capacity][10] = {0} int main(){ int option; bool availibility = false; bool availibility_other = false; for(int x=0;x<12;x++){ //option select option = option_select(); //check seats availibility in selected section availibility = availibility_checking(option); if(availibility == 1){ //if there is available place print boarding pass reserve_boarding(option); } else //if there is no available place, check seats availability...
Comments
Post a Comment