The document contains C++ code examples demonstrating various concepts in C++ including input/output, conditional statements, loops, functions, classes, constructors, operator overloading, and more. There are multiple short programs presented one after another without additional context or explanation.
This document provides an overview of footprinting and reconnaissance techniques used by hackers to gather sensitive information about target organizations. It discusses various footprinting methods like using search engines, social media, websites, email headers, WHOIS lookups and more to find out details on employees, network infrastructure, systems and technologies used. The document also outlines tools that can be used for footprinting and recommends steps organizations can take to prevent information leakage and footprinting attacks like limiting employee access, filtering website content, encoding sensitive data and conducting regular security assessments.
The document contains code snippets for various Java programs that perform tasks like calculating the area of a circle, finding the factorial of a number, displaying prime numbers, sorting an array, counting characters in a string, reversing a string, creating and running threads, handling exceptions, and creating a simple applet with buttons to change the background color. The code examples demonstrate basic Java programming concepts like classes, methods, loops, arrays, exceptions, threads, applets, and event handling.
Proof Techniques
There are some of the most common proof techniques.
1. Direct Proof
2. Proof by Contradiction
3. Proof by Contapositive
4. Proof by Cases
Python supports several numeric and non-numeric data types including integers, floats, complex numbers, strings, lists, and tuples. Numbers can be integers, floats, or complex, and support common operations. Strings are immutable sequences of characters that can be indexed, sliced, formatted, and concatenated. Lists are mutable sequences that can contain mixed data types, and support common operations like indexing, slicing, sorting, and joining. Tuples are similar to lists but are immutable.
Structures in C# are similar to classes but are value types stored on the stack. The document defines a Student struct with roll_number and Name properties, and shows how to declare a variable of the struct type, assign values to its properties, and copy one struct to another. Structs can also contain methods, as shown in the Rectangle struct example which defines a constructor, Area method, and Display method. Nested structs are also possible, like an Employee struct containing a nested Salary struct. The key differences between structs and classes are that structs are value types stored on the stack while classes are reference types.
This document provides a lab manual for the fourth semester computer science engineering course on Object Oriented Technology. It includes the syllabus, rationale for object oriented programming, hardware and software requirements, a list of practical experiments to be conducted, and sample code for some of the experiments. The experiments cover topics like function overloading, inheritance, polymorphism, constructors, destructors, copy constructors, friend functions, and use of local, static and global objects. Each experiment is followed by sample output and questions related to the concepts covered in the program. The document aims to provide guidance to students on the practical implementation of object oriented programming concepts using C++.
This document provides an overview of footprinting and reconnaissance techniques used by hackers to gather sensitive information about target organizations. It discusses various footprinting methods like using search engines, social media, websites, email headers, WHOIS lookups and more to find out details on employees, network infrastructure, systems and technologies used. The document also outlines tools that can be used for footprinting and recommends steps organizations can take to prevent information leakage and footprinting attacks like limiting employee access, filtering website content, encoding sensitive data and conducting regular security assessments.
The document contains code snippets for various Java programs that perform tasks like calculating the area of a circle, finding the factorial of a number, displaying prime numbers, sorting an array, counting characters in a string, reversing a string, creating and running threads, handling exceptions, and creating a simple applet with buttons to change the background color. The code examples demonstrate basic Java programming concepts like classes, methods, loops, arrays, exceptions, threads, applets, and event handling.
Proof Techniques
There are some of the most common proof techniques.
1. Direct Proof
2. Proof by Contradiction
3. Proof by Contapositive
4. Proof by Cases
Python supports several numeric and non-numeric data types including integers, floats, complex numbers, strings, lists, and tuples. Numbers can be integers, floats, or complex, and support common operations. Strings are immutable sequences of characters that can be indexed, sliced, formatted, and concatenated. Lists are mutable sequences that can contain mixed data types, and support common operations like indexing, slicing, sorting, and joining. Tuples are similar to lists but are immutable.
Structures in C# are similar to classes but are value types stored on the stack. The document defines a Student struct with roll_number and Name properties, and shows how to declare a variable of the struct type, assign values to its properties, and copy one struct to another. Structs can also contain methods, as shown in the Rectangle struct example which defines a constructor, Area method, and Display method. Nested structs are also possible, like an Employee struct containing a nested Salary struct. The key differences between structs and classes are that structs are value types stored on the stack while classes are reference types.
This document provides a lab manual for the fourth semester computer science engineering course on Object Oriented Technology. It includes the syllabus, rationale for object oriented programming, hardware and software requirements, a list of practical experiments to be conducted, and sample code for some of the experiments. The experiments cover topics like function overloading, inheritance, polymorphism, constructors, destructors, copy constructors, friend functions, and use of local, static and global objects. Each experiment is followed by sample output and questions related to the concepts covered in the program. The document aims to provide guidance to students on the practical implementation of object oriented programming concepts using C++.
The document discusses cyber crime and its various aspects. It defines cyber crime as any criminal activity using computers as tools or targets. Various types of cyber crimes are described such as hacking, theft of information, email bombing, and denial of service attacks. Cyber crimes can be against individuals, organizations, or society. The document also discusses cyber terrorism and classifications of cyber crimes. It outlines sections of the Indian IT Act related to cyber crimes and penalties. Prevention tips are provided such as using antivirus software and being cautious online. While laws aim to reduce crime, legislation alone cannot eliminate it completely.
The document contains 7 tasks involving flowcharts, pseudocode, and Python code. The tasks include calculating costs based on item prices, checking grades, accepting positive numbers only, comparing and performing operations on input numbers, converting between pounds and kilograms, and calculating percentage grades and remarks. Pseudocode and Python code are provided to solve each problem described by its corresponding flowchart.
The document discusses one-dimensional arrays in C++. It defines an array as a group of like-type data where each element is referred to by an index. It describes how to declare arrays by specifying a type, name, and size. Elements in an array are accessed using subscript notation, with the first element having an index of 0. The document also covers initializing array elements either explicitly by assigning each one, or using an initialization list within braces.
This document discusses strings in C++. It begins by explaining that strings are stored as character arrays terminated by a null character. It then covers declaring and initializing strings, accessing characters within strings, inputting and outputting strings using cin, gets(), and getline(), and comparing and copying strings. The document also discusses two-dimensional character arrays for storing arrays of strings. It provides examples of initializing, inputting, and displaying 2D string arrays.
This document provides acknowledgements and thanks for those who helped with a hospital management database project. It thanks the teacher, friends, and seniors for their guidance, encouragement, information and experience during the project preparation. It includes the C++ code for the hospital management database program, which implements a queue to manage patients in different hospital departments like heart, lung, and plastic surgery. Users can add, remove, view patients and switch between departments using the program.
The document discusses classes and objects in object-oriented programming. It defines what a class is, how classes are declared with public and private members, and how objects are instantiated from classes. It also describes defining member functions inside and outside of classes, and the use of static class members and friend functions.
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)Make Mannan
This document provides a lab manual for experiments on data structures. It includes 20 experiments covering topics like arrays, matrices, recursion, strings, stacks, queues, linked lists, trees, graphs and sorting algorithms. Each experiment contains the aim, introduction, source code, sample output and questions. The experiments provide hands-on practice with commonly used data structures and algorithms.
The document contains 10 programs related to sorting and graph algorithms. Program 1-7 implement different sorting algorithms - insertion sort, selection sort, heap sort, quick sort, counting sort, merge sort and radix sort. Program 8 implements the greedy knapsack problem. Program 9 implements the travelling salesman problem. Program 10 implements Kruskal's algorithm to find the minimum spanning tree of a graph.
Python provides numerous built-in functions that are readily available to us at the Python prompt. Some of the functions like input() and print() are widely used for standard input and output operations respectively.
The document discusses functions in C programming. It defines what a function is, how functions are declared and defined, how to pass arguments to functions, and different ways to call functions. It provides examples of using functions to calculate factorials, Fibonacci series, find the highest common factor and lowest common multiple of two numbers, and sum the digits of a number recursively. Various ways of implementing functions using loops, recursion, and by passing arguments are demonstrated through code examples.
The document is a presentation on pointers that contains several key points:
1) Pointers store the address of other variables and can be used to indirectly access or modify the value of the variable being pointed to.
2) The ampersand (&) operator returns the address of a variable and is called the reference operator. The asterisk (*) operator accesses the value of the variable a pointer is pointing to and is called the dereference operator.
3) Pointers must be declared with a data type that specifies the type of variable they will point to, such as int*, char*, or float*.
Cybercrime refers to criminal acts that involve computers or networks, such as hacking, uploading obscene content, or hacking into banking accounts. Cybercrime has grown with increased internet usage and technology. Types of cybercrime include salami attacks, packet sniffing, tempest attacks, and bot networks. Governments, police, and organizations are increasingly concerned with cybercrime due to its growing severity and frequency in recent years. This paper provides an overview of cybercrime and examines awareness of cybercrime issues to emphasize its impact worldwide.
C++ is an object-oriented programming language that is based on classes and objects. A C++ program is made up of classes, which contain methods and variables. The basic building block of a C++ program is the class. A class defines the structure and behavior of an object. Objects are instances of classes that contain their own set of properties and behaviors. The main() method acts as the entry point for program execution. C++ supports features like functions, arrays, control statements, strings and more.
This document contains 8 C programming code examples demonstrating various scheduling algorithms:
1. First Come First Serve scheduling
2. Non-preemptive Shortest Job First scheduling
3. Round Robin scheduling
4. Priority scheduling
5. Banker's algorithm for deadlock avoidance
6. Producer-consumer problem synchronization
7. Dekker's algorithm for mutual exclusion
Each program example includes comments explaining the algorithm and includes functions to calculate waiting times, turnaround times, and other metrics.
Variables in C programming can have local, global, or formal (parameter) scope. [1] Local variables are declared within a function and can only be accessed within that function. [2] Global variables are declared outside of functions and can be accessed anywhere. [3] Formal parameters declared in a function signature take precedence over global variables of the same name within that function.
The document provides a list of keyboard shortcuts for Microsoft Excel. It includes shortcuts for common functions like opening and saving documents, printing, formatting cells, inserting comments and charts, navigating sheets, and highlighting and copying cell ranges. The shortcuts are organized into tables by function for easy reference.
Hacking can take many forms, both legal and illegal. The document outlines different types of hacking such as website, email, network, and password hacking. Ethical hacking is performed legally by computer experts to test vulnerabilities, while illegal hacking can have serious consequences like fines, imprisonment, and computer seizure. Proper precautions are recommended to prevent hacking threats.
Arrays in Python can hold multiple values and each element has a numeric index. Arrays can be one-dimensional (1D), two-dimensional (2D), or multi-dimensional. Common operations on arrays include accessing elements, adding/removing elements, concatenating arrays, slicing arrays, looping through elements, and sorting arrays. The NumPy library provides powerful capabilities to work with n-dimensional arrays and matrices.
Hacking involves gaining unauthorized access to computer systems, which is illegal. There are different types of hackers, including white hats who help find security vulnerabilities, black hats who hack with malicious intent, and grey hats in between. Reasons for hacking include financial gain, showing off skills, or just for fun. Experts recommend using antivirus software, avoiding suspicious links and downloads, and keeping software updated to help prevent hacking.
C structures allow grouping of related data items under one name. Structures are scalars that can be passed as function arguments or assigned to variables. Unions share the same memory region for all members, so only one member can be accessed at a time. Both structures and unions allow organizing related data and passing groups of data together.
The document contains code snippets that demonstrate differences between C++98 and C++11. Some key differences shown include:
- C++11 introduced auto keyword to infer variable types in for loops.
- C++11 introduced nullptr to replace NULL pointer value and avoid ambiguity with integer 0.
- C++11 added const_cast, static_cast, dynamic_cast and reinterpret_cast to safely cast pointer/reference types.
The document contains C++ code examples demonstrating various programming concepts like:
1. A program that takes input from the user, performs addition if the input letter is 'A' and prints output. Otherwise it prints invalid letter.
2. Multiple code snippets showing the use of for loops, if-else conditions, functions and arithmetic operations.
3. Code examples to find even/odd numbers in an array, check if a number is prime, calculate factorials, print multiplication tables and find the sum of numbers.
The document discusses cyber crime and its various aspects. It defines cyber crime as any criminal activity using computers as tools or targets. Various types of cyber crimes are described such as hacking, theft of information, email bombing, and denial of service attacks. Cyber crimes can be against individuals, organizations, or society. The document also discusses cyber terrorism and classifications of cyber crimes. It outlines sections of the Indian IT Act related to cyber crimes and penalties. Prevention tips are provided such as using antivirus software and being cautious online. While laws aim to reduce crime, legislation alone cannot eliminate it completely.
The document contains 7 tasks involving flowcharts, pseudocode, and Python code. The tasks include calculating costs based on item prices, checking grades, accepting positive numbers only, comparing and performing operations on input numbers, converting between pounds and kilograms, and calculating percentage grades and remarks. Pseudocode and Python code are provided to solve each problem described by its corresponding flowchart.
The document discusses one-dimensional arrays in C++. It defines an array as a group of like-type data where each element is referred to by an index. It describes how to declare arrays by specifying a type, name, and size. Elements in an array are accessed using subscript notation, with the first element having an index of 0. The document also covers initializing array elements either explicitly by assigning each one, or using an initialization list within braces.
This document discusses strings in C++. It begins by explaining that strings are stored as character arrays terminated by a null character. It then covers declaring and initializing strings, accessing characters within strings, inputting and outputting strings using cin, gets(), and getline(), and comparing and copying strings. The document also discusses two-dimensional character arrays for storing arrays of strings. It provides examples of initializing, inputting, and displaying 2D string arrays.
This document provides acknowledgements and thanks for those who helped with a hospital management database project. It thanks the teacher, friends, and seniors for their guidance, encouragement, information and experience during the project preparation. It includes the C++ code for the hospital management database program, which implements a queue to manage patients in different hospital departments like heart, lung, and plastic surgery. Users can add, remove, view patients and switch between departments using the program.
The document discusses classes and objects in object-oriented programming. It defines what a class is, how classes are declared with public and private members, and how objects are instantiated from classes. It also describes defining member functions inside and outside of classes, and the use of static class members and friend functions.
Lab manual data structure (cs305 rgpv) (usefulsearch.org) (useful search)Make Mannan
This document provides a lab manual for experiments on data structures. It includes 20 experiments covering topics like arrays, matrices, recursion, strings, stacks, queues, linked lists, trees, graphs and sorting algorithms. Each experiment contains the aim, introduction, source code, sample output and questions. The experiments provide hands-on practice with commonly used data structures and algorithms.
The document contains 10 programs related to sorting and graph algorithms. Program 1-7 implement different sorting algorithms - insertion sort, selection sort, heap sort, quick sort, counting sort, merge sort and radix sort. Program 8 implements the greedy knapsack problem. Program 9 implements the travelling salesman problem. Program 10 implements Kruskal's algorithm to find the minimum spanning tree of a graph.
Python provides numerous built-in functions that are readily available to us at the Python prompt. Some of the functions like input() and print() are widely used for standard input and output operations respectively.
The document discusses functions in C programming. It defines what a function is, how functions are declared and defined, how to pass arguments to functions, and different ways to call functions. It provides examples of using functions to calculate factorials, Fibonacci series, find the highest common factor and lowest common multiple of two numbers, and sum the digits of a number recursively. Various ways of implementing functions using loops, recursion, and by passing arguments are demonstrated through code examples.
The document is a presentation on pointers that contains several key points:
1) Pointers store the address of other variables and can be used to indirectly access or modify the value of the variable being pointed to.
2) The ampersand (&) operator returns the address of a variable and is called the reference operator. The asterisk (*) operator accesses the value of the variable a pointer is pointing to and is called the dereference operator.
3) Pointers must be declared with a data type that specifies the type of variable they will point to, such as int*, char*, or float*.
Cybercrime refers to criminal acts that involve computers or networks, such as hacking, uploading obscene content, or hacking into banking accounts. Cybercrime has grown with increased internet usage and technology. Types of cybercrime include salami attacks, packet sniffing, tempest attacks, and bot networks. Governments, police, and organizations are increasingly concerned with cybercrime due to its growing severity and frequency in recent years. This paper provides an overview of cybercrime and examines awareness of cybercrime issues to emphasize its impact worldwide.
C++ is an object-oriented programming language that is based on classes and objects. A C++ program is made up of classes, which contain methods and variables. The basic building block of a C++ program is the class. A class defines the structure and behavior of an object. Objects are instances of classes that contain their own set of properties and behaviors. The main() method acts as the entry point for program execution. C++ supports features like functions, arrays, control statements, strings and more.
This document contains 8 C programming code examples demonstrating various scheduling algorithms:
1. First Come First Serve scheduling
2. Non-preemptive Shortest Job First scheduling
3. Round Robin scheduling
4. Priority scheduling
5. Banker's algorithm for deadlock avoidance
6. Producer-consumer problem synchronization
7. Dekker's algorithm for mutual exclusion
Each program example includes comments explaining the algorithm and includes functions to calculate waiting times, turnaround times, and other metrics.
Variables in C programming can have local, global, or formal (parameter) scope. [1] Local variables are declared within a function and can only be accessed within that function. [2] Global variables are declared outside of functions and can be accessed anywhere. [3] Formal parameters declared in a function signature take precedence over global variables of the same name within that function.
The document provides a list of keyboard shortcuts for Microsoft Excel. It includes shortcuts for common functions like opening and saving documents, printing, formatting cells, inserting comments and charts, navigating sheets, and highlighting and copying cell ranges. The shortcuts are organized into tables by function for easy reference.
Hacking can take many forms, both legal and illegal. The document outlines different types of hacking such as website, email, network, and password hacking. Ethical hacking is performed legally by computer experts to test vulnerabilities, while illegal hacking can have serious consequences like fines, imprisonment, and computer seizure. Proper precautions are recommended to prevent hacking threats.
Arrays in Python can hold multiple values and each element has a numeric index. Arrays can be one-dimensional (1D), two-dimensional (2D), or multi-dimensional. Common operations on arrays include accessing elements, adding/removing elements, concatenating arrays, slicing arrays, looping through elements, and sorting arrays. The NumPy library provides powerful capabilities to work with n-dimensional arrays and matrices.
Hacking involves gaining unauthorized access to computer systems, which is illegal. There are different types of hackers, including white hats who help find security vulnerabilities, black hats who hack with malicious intent, and grey hats in between. Reasons for hacking include financial gain, showing off skills, or just for fun. Experts recommend using antivirus software, avoiding suspicious links and downloads, and keeping software updated to help prevent hacking.
C structures allow grouping of related data items under one name. Structures are scalars that can be passed as function arguments or assigned to variables. Unions share the same memory region for all members, so only one member can be accessed at a time. Both structures and unions allow organizing related data and passing groups of data together.
The document contains code snippets that demonstrate differences between C++98 and C++11. Some key differences shown include:
- C++11 introduced auto keyword to infer variable types in for loops.
- C++11 introduced nullptr to replace NULL pointer value and avoid ambiguity with integer 0.
- C++11 added const_cast, static_cast, dynamic_cast and reinterpret_cast to safely cast pointer/reference types.
The document contains C++ code examples demonstrating various programming concepts like:
1. A program that takes input from the user, performs addition if the input letter is 'A' and prints output. Otherwise it prints invalid letter.
2. Multiple code snippets showing the use of for loops, if-else conditions, functions and arithmetic operations.
3. Code examples to find even/odd numbers in an array, check if a number is prime, calculate factorials, print multiplication tables and find the sum of numbers.
This C++ code defines functions to read input, calculate remainders and absolute differences of numbers modulo a given value k, find the maximum of these values, and output the minimum maximum. It takes as input the number of test cases t, reads the input n and k for each test case, calculates remainders and differences of an array of n numbers modulo k, finds the maximum of each, and outputs the minimum of the two maxima.
The document contains examples of various C++ programs and SQL commands. Some of the C++ programs include binary search, linear search, bubble sort, selection sort, insertion sort, copy constructor, parametrized constructor, lower matrix, sum of matrices, nesting, pointers, linear queue, circular queue, reading and writing binary files. The SQL commands include showing databases, creating a database, creating and describing a table, inserting and selecting data, altering a table by adding or dropping a column, using LIKE in select statements, and ordering results.
The document discusses various C++ algorithms like swap, max, min, sort, find, binary_search, count, copy, fill, count_if, remove, for_each and their usage with examples. It explains what each algorithm does, its prototype and shows code snippets to demonstrate how it can be used.
I have written the code but cannot complete the assignment please help.pdfshreeaadithyaacellso
I have written the code but cannot complete the assignment please help me to complete.
Please don't just copy other s answers as your own.
// Insertion sort
/*
#include <ctime>
#include <iostream>
using namespace std;
void insertionSort(int arr[], int n) {
int i, key, j;
for (i = 1; i < n; i++) {
key = arr[i];
j = i - 1;
// Move elements of arr[0..i-1], that are greater than key, to one position ahead of their current
position
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] = key;
}
}
int main() {
int n;
cout << "Enter the size of the array: ";
cin >> n;
int arr[n];
cout << "Enter the elements of the array: ";
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int num = sizeof(arr) / sizeof(arr[0]);
clock_t start, end;
double timetaken;
start = clock();
insertionSort(arr, num);
end = clock();
cout << "Sorted array: \n";
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
cout << endl;
timetaken = ((double) (end - start)) / CLOCKS_PER_SEC;
cout << "Time taken : " << fixed << timetaken << "s" << endl;
return 0;
}
*/
// Shell Sort
/*
#include <ctime>
#include <iostream>
using namespace std;
int shellSort(int arr[], int n) {
for (int gap = n/2; gap > 0; gap /= 2) {
for (int i = gap; i < n; i += 1) {
int temp = arr[i];
int j;
for (j = i; j >= gap && arr[j - gap] > temp; j -= gap)
arr[j] = arr[j - gap];
arr[j] = temp;
}
}
return 0;
}
void printArray(int arr[], int n) {
for (int i=0; i<n; i++)
cout << arr[i] << " ";
}
int main() {
int n;
cout << "Enter the size of the array: ";
cin >> n;
int arr[n];
cout << "Enter the elements of the array: ";
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int num = sizeof(arr) / sizeof(arr[0]);
clock_t start, end;
double timetaken;
start = clock();
shellSort(arr, num);
end = clock();
cout << "\nArray after sorting: \n";
printArray(arr, n);
cout << endl;
timetaken = (double)(end - start) / CLOCKS_PER_SEC;
cout << "Time taken : " << fixed << timetaken << "s" << endl;
return 0;
}
*/
// MergeSort
/*
#include <ctime>
#include <iostream>
using namespace std;
void merge(int arr[], int l, int m, int r) {
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
int L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1 + j];
i = 0;
j = 0;
k = l;
while (i < n1 && j < n2) {
if (L[i] <= R[j]) {
arr[k] = L[i];
i++;
}
else {
arr[k] = R[j];
j++;
}
k++;
}
while (i < n1) {
arr[k] = L[i];
i++;
k++;
}
while (j < n2) {
arr[k] = R[j];
j++;
k++;
}
}
void mergeSort(int arr[], int l, int r) {
if (l < r) {
int m = l + (r - l) / 2;
mergeSort(arr, l, m);
mergeSort(arr, m + 1, r);
merge(arr, l, m, r);
}
}
int main() {
int n;
cout << "Enter the size of the array: ";
cin >> n;
int arr[n];
cout << "Enter the elements of the array: ";
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int arr_size = sizeof(arr) / sizeof(arr[0]);
clock_t start;
clock_t end;
double timetaken;
start = clock();
mergeSort(arr, 0, arr_size - 1);
end = clock();
timetaken = (double)(end - start) / CLOCKS_PER_SEC;
.
The document contains code snippets demonstrating different types of loops in C++ including for, while, do-while loops. It also shows examples of using break, continue and flag-controlled loops. Nested loops and sentinel controlled loops are presented. The output of the code snippets is also discussed in some cases.
The document contains code snippets and explanations for various string, number, array, and pattern problems in C programming. It includes functions to count characters and words in a string, reverse a string, change case, sort strings, check if strings are anagrams, reverse numbers, find factors, and more. It also includes examples of binary search on arrays, reversing and merging arrays, and calculating bit differences between numbers.
The document contains 3 C++ programs:
1. A program that takes user input for a height and prints an hourglass pattern of that height using asterisks.
2. A program that takes user input for a number of asterisks and prints a diamond pattern of that size.
3. A program that takes the same user input as #2 and prints a pattern resembling the flag of Nepal by stacking 4 diamond patterns on top of each other.
The document contains multiple C++ code examples for programming exercises. It includes code to generate and output matrices, sort vectors, loop through ranges printing values, and calculate averages of two digit numbers. Jefferson Caiza is listed as the student name for the programming course. The code examples demonstrate basic programming concepts like loops, arrays, conditionals, and math operations.
The document contains examples demonstrating various object-oriented programming concepts in C++ including constructors, destructors, inheritance, polymorphism, operator overloading, templates, and more. Each example includes the code for a concept, the output of running the code, and a brief description.
The document contains 27 code examples that demonstrate various programming concepts in C++, including:
1. Printing numeric patterns using nested for loops.
2. Finding the largest number among 3 inputs using if/else statements and functions.
3. Calculating factorials, prime numbers, Fibonacci sequences and number tables using for loops.
4. Checking if a number is even/odd using if/else.
5. Illustrating the use of classes to store student data like roll numbers and marks in multiple subjects.
6. Defining functions both inside and outside classes to get/set data member values.
The code snippets cover basic programming constructs like loops, functions, classes,
This document contains 17 programming problems and their solutions involving object oriented programming concepts like classes, objects, functions, arrays, pointers etc. The problems cover basic concepts like calculating factorial, checking prime number, Fibonacci series, arithmetic operations using menus. More advanced concepts covered include sorting, searching, function overloading, complex numbers, class/object concepts like constructors, destructors and member functions to maintain student records.
This document contains 17 programming problems and their solutions involving object oriented programming concepts like classes, objects, functions, arrays, pointers etc. The problems cover basic concepts like calculating factorial, checking prime number, Fibonacci series, arithmetic operations using menus, finding largest element in array. More advanced concepts covered are bubble sort, selection sort, function overloading to calculate area of shapes, complex number addition using friend functions, student record management using classes. Overall, the document aims to provide practice on common OOP concepts through solving different programming problems.
This document contains code snippets from a student's practical work using Microsoft Visual Studio C++. It includes 15 code modules that demonstrate basics of C++ programming like input/output, data types, operators, conditional statements and functions. The modules progress from simple print statements to more complex concepts like nested if-else statements and switch cases. Each module is preceded by comments identifying the topic and module number.
C++ Language Basics covers the history of C++, some drawbacks of C, input/output operators, variable declaration, the bool datatype, typecasting, and references. C++ was created in 1979 as an extension of C to support object-oriented programming. It has undergone several updates since then. References allow creating aliases to existing variables, avoiding issues with pointers. Input is handled with cin and output with cout. Variables can be declared anywhere in C++ code unlike in C. The bool datatype represents true and false values.
The document discusses C++ programs involving classes and objects. It includes the definition of classes such as Applicant, Housing, Tour, Account and subclasses Current and Savings. The Applicant class stores applicant details and grades, Housing stores housing property data, Tour calculates tour fares, and Account is the base class for banking accounts with subclasses Current and Savings that inherit and expand its functionality. Member functions are defined to input, output and manipulate object data for these classes.
This C++ code defines functions for calculating the range of an object based on its initial velocity, time, and acceleration. It also defines a structure for storing numbers and a function for multiplying three numbers. The main function calls the range function, stores the result in a variable, calls a function to check if the result is positive or negative, and prints the outputs. It then defines three number objects, calls the multiplication function on their values, and prints the results while demonstrating pointer usage.
The document contains 3 programming exercises in Spanish. The first exercise prints the result of a modulo and addition operation on a user-input number. The second exercise initializes and prints a 6x5 matrix with values of i*j. The third exercise initializes an array of 11 elements with values of (aux%2)*j and prints it.
artificial intelligence and data science contents.pptxGauravCar
What is artificial intelligence? Artificial intelligence is the ability of a computer or computer-controlled robot to perform tasks that are commonly associated with the intellectual processes characteristic of humans, such as the ability to reason.
› ...
Artificial intelligence (AI) | Definitio
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Sinan KOZAK
Sinan from the Delivery Hero mobile infrastructure engineering team shares a deep dive into performance acceleration with Gradle build cache optimizations. Sinan shares their journey into solving complex build-cache problems that affect Gradle builds. By understanding the challenges and solutions found in our journey, we aim to demonstrate the possibilities for faster builds. The case study reveals how overlapping outputs and cache misconfigurations led to significant increases in build times, especially as the project scaled up with numerous modules using Paparazzi tests. The journey from diagnosing to defeating cache issues offers invaluable lessons on maintaining cache integrity without sacrificing functionality.
Discover the latest insights on Data Driven Maintenance with our comprehensive webinar presentation. Learn about traditional maintenance challenges, the right approach to utilizing data, and the benefits of adopting a Data Driven Maintenance strategy. Explore real-world examples, industry best practices, and innovative solutions like FMECA and the D3M model. This presentation, led by expert Jules Oudmans, is essential for asset owners looking to optimize their maintenance processes and leverage digital technologies for improved efficiency and performance. Download now to stay ahead in the evolving maintenance landscape.
Software Engineering and Project Management - Introduction, Modeling Concepts...Prakhyath Rai
Introduction, Modeling Concepts and Class Modeling: What is Object orientation? What is OO development? OO Themes; Evidence for usefulness of OO development; OO modeling history. Modeling
as Design technique: Modeling, abstraction, The Three models. Class Modeling: Object and Class Concept, Link and associations concepts, Generalization and Inheritance, A sample class model, Navigation of class models, and UML diagrams
Building the Analysis Models: Requirement Analysis, Analysis Model Approaches, Data modeling Concepts, Object Oriented Analysis, Scenario-Based Modeling, Flow-Oriented Modeling, class Based Modeling, Creating a Behavioral Model.
An improved modulation technique suitable for a three level flying capacitor ...IJECEIAES
This research paper introduces an innovative modulation technique for controlling a 3-level flying capacitor multilevel inverter (FCMLI), aiming to streamline the modulation process in contrast to conventional methods. The proposed
simplified modulation technique paves the way for more straightforward and
efficient control of multilevel inverters, enabling their widespread adoption and
integration into modern power electronic systems. Through the amalgamation of
sinusoidal pulse width modulation (SPWM) with a high-frequency square wave
pulse, this controlling technique attains energy equilibrium across the coupling
capacitor. The modulation scheme incorporates a simplified switching pattern
and a decreased count of voltage references, thereby simplifying the control
algorithm.
Introduction- e - waste – definition - sources of e-waste– hazardous substances in e-waste - effects of e-waste on environment and human health- need for e-waste management– e-waste handling rules - waste minimization techniques for managing e-waste – recycling of e-waste - disposal treatment methods of e- waste – mechanism of extraction of precious metal from leaching solution-global Scenario of E-waste – E-waste in India- case studies.
Rainfall intensity duration frequency curve statistical analysis and modeling...bijceesjournal
Using data from 41 years in Patna’ India’ the study’s goal is to analyze the trends of how often it rains on a weekly, seasonal, and annual basis (1981−2020). First, utilizing the intensity-duration-frequency (IDF) curve and the relationship by statistically analyzing rainfall’ the historical rainfall data set for Patna’ India’ during a 41 year period (1981−2020), was evaluated for its quality. Changes in the hydrologic cycle as a result of increased greenhouse gas emissions are expected to induce variations in the intensity, length, and frequency of precipitation events. One strategy to lessen vulnerability is to quantify probable changes and adapt to them. Techniques such as log-normal, normal, and Gumbel are used (EV-I). Distributions were created with durations of 1, 2, 3, 6, and 24 h and return times of 2, 5, 10, 25, and 100 years. There were also mathematical correlations discovered between rainfall and recurrence interval.
Findings: Based on findings, the Gumbel approach produced the highest intensity values, whereas the other approaches produced values that were close to each other. The data indicates that 461.9 mm of rain fell during the monsoon season’s 301st week. However, it was found that the 29th week had the greatest average rainfall, 92.6 mm. With 952.6 mm on average, the monsoon season saw the highest rainfall. Calculations revealed that the yearly rainfall averaged 1171.1 mm. Using Weibull’s method, the study was subsequently expanded to examine rainfall distribution at different recurrence intervals of 2, 5, 10, and 25 years. Rainfall and recurrence interval mathematical correlations were also developed. Further regression analysis revealed that short wave irrigation, wind direction, wind speed, pressure, relative humidity, and temperature all had a substantial influence on rainfall.
Originality and value: The results of the rainfall IDF curves can provide useful information to policymakers in making appropriate decisions in managing and minimizing floods in the study area.
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...IJECEIAES
Medical image analysis has witnessed significant advancements with deep learning techniques. In the domain of brain tumor segmentation, the ability to
precisely delineate tumor boundaries from magnetic resonance imaging (MRI)
scans holds profound implications for diagnosis. This study presents an ensemble convolutional neural network (CNN) with transfer learning, integrating
the state-of-the-art Deeplabv3+ architecture with the ResNet18 backbone. The
model is rigorously trained and evaluated, exhibiting remarkable performance
metrics, including an impressive global accuracy of 99.286%, a high-class accuracy of 82.191%, a mean intersection over union (IoU) of 79.900%, a weighted
IoU of 98.620%, and a Boundary F1 (BF) score of 83.303%. Notably, a detailed comparative analysis with existing methods showcases the superiority of
our proposed model. These findings underscore the model’s competence in precise brain tumor localization, underscoring its potential to revolutionize medical
image analysis and enhance healthcare outcomes. This research paves the way
for future exploration and optimization of advanced CNN models in medical
imaging, emphasizing addressing false positives and resource efficiency.
7. num/=10;
}
if(result==number)
cout<<"Part of Memorable Coin";
else
cout<<"Not a Part of Memorable Coin";
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int nooffamilymembers,i,j;
cin>>nooffamilymembers;
for(i=nooffamilymembers;i>0;i--)
{
10. int M,initialtemp,finaltemp;
float Q;
cin>>M>>initialtemp>>finaltemp;
Q=M*(finaltemp - initialtemp)*4184;
cout<<""<<Q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int husage,wfage,coupleavgage;
cin>>husage>>wfage;
coupleavgage=(husage+wfage)/2;
cout<<"I am "<<husage<<endl<<"You are "<<wfage<<endl<<"We are around "<<coupleavgage;
return 0;
11. }
#include <iostream>
using namespace std;
int main()
{
int weightinearth;
cin>>weightinearth;
float weightinmoon;
weightinmoon=0.166*weightinearth;
cout<<weightinmoon;
return 0;
12. }
CLASSES METHODS AND CONSTRUCTORS:-
#include <iostream>
using namespace std;
class Happiness{
public:int Meat(){
int n,a,b,max=100,sum=0;
cin>>n;
while(n--)
{
cin>>a>>b;
//max=b;
if(b>=max)
sum+=a*max;
// cout<<max<<endl;
14. #include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
double a[18][18], b[1 << 18];
int fun(int x) {
int s = 0;
while (x)
{
s += x & 1;
x >>= 1;
}
return s;
}
int main() {
if(0)
cout<<"class Lake public:void survival() fish.survival();";
int n, i, r, t, j;
cin >> n;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
scanf("%lf", &a[i][j]);
memset(b, 0, sizeof(b));
b[(1 << n) - 1] = 1;
for (i = (1 << n) - 1; i >= 0; i--) {
int c = fun(i);
c = c * (c - 1) / 2;
for (r = 0; r < n; r++)
if (i & (1 << r))
for (t = 0; t < n; t++)
15. if (i & (1 << t))
b[i - (1 << t)] += b[i] * a[r][t] / c;
}
for (r = 0; r < n - 1; r++)
printf("%.6lf ", b[1 << r]);
printf("%.6lfn", b[1 << r]);
}
#include <iostream>
#include<cstring>
#include<string>
using namespace std;
class aadhaar
{
public:
void NameofCitizen(string fn,string mn,string ln)
{
20. using namespace std;
class Friends
{
public:void Gifts(){
int i, n, a, b[50] = { 0 };
cin >> n;
for (i = 1; i < n+1; i++)
{
cin >> a;
b[a] = i;
}
for (i = 1; i < n+1; i++)
cout<< b[i]<<" ";
}
};
int main()
{
Friends Sharing;
Sharing.Gifts();
}
21. #include<bits/stdc++.h>
using namespace std;
class Drinks{
int n,a,b,c,t,ans=0;
public:void Shop(){
cin>>n>>a>>b>>c;
}
void display(){
for(int i=0;i<=b;i++)
for(int j=0;j<=c;j++)
if(2*(n-i-j*2)>=0&&2*(n-i-j*2)<=a)
ans++;
cout<<ans;
}
};
int main(){
Drinks Buy;
Buy.Shop();
Buy.display();
22. }
#include <bits/stdc++.h>
using namespace std;
class IndianArmy
{
public:int ResumesofCamdidates(){
long long n;
cin>>n;
long long k=n*(n-1)*(n-2)*(n-3)*(n-4)/120;
cout<<k+k*(n-5)/6+k*(n-5)*(n-6)/42;
return 1;
}
};
int main(){
IndianArmy GroupingofResumes;
GroupingofResumes.ResumesofCamdidates();
return 0;
}
23. #include <iostream>
using namespace std;
class ITEM
{
public:
int n;
float large=0,summ=0;
float arr[100],code[100];
void getdata(int b){
n=b;
for(int i=0;i<n;i++)
cin>>code[i]>>arr[i];
}
void largest(){
for(int i=0;i<n;i++)
{
24. if(arr[i]>=large)
large=arr[i];
}
}
void sum(){
for(int i=0;i<n;i++)
summ+=arr[i];
}
void displayitems(){
cout<<"Largest Price="<<large<<endl;
cout<<"Sum of Prices="<<summ<<endl;
cout<<"Code and Price"<<endl;
for(int i=0;i<n;i++)
cout<<code[i]<<" and "<<arr[i]<<endl;
}
};
using namespace std;
int main()
{
ITEM order;
int b;
cin>>b;
order.getdata(b);
order.largest();
order.sum();
order.displayitems();
return 0;
}
25. #include<iostream>
using namespace std;
class Complex{
public:
int r1,i1,r2,i2,r3,i3;
Complex(){cin>>r1>>i1;cin>>r2>>i2;}
void addcomplex(){
r3=r1+r2;
i3=i1+i2;
}
void displaycomplex(){
cout<<r1<<"+"<<i1<<"i"<<endl;
cout<<r2<<"+"<<i2<<"i"<<endl;
cout<<r3<<"+"<<i3<<"i"<<endl;
}
};
int main(){
33. #include <iostream>
using namespace std;
class Olympic{
public:
void distance(int D1,int D2){
cout<<D1+D2<<" meters"<<endl;
}
void distance(int D3, int D4, int D5){
cout<<D3+D4+D5<<" meters"<<endl;
}
};
int main()
{
Olympic Medal;
int D1,D2,D3,D4,D5;
cin>>D1>>D2>>D3>>D4>>D5;
Medal.distance(D1,D2);
Medal.distance(D3,D4,D5);
34. return 0;
}
#include <iostream>
using namespace std;
int power(int x,int p);
int power(int x,int y,int p);
int main()
{
int t;
cin>>t;
while(t--){
int n,odd=0;
cin>>n;
int z=power(n,odd);
//cout<<n<<z;
power(n,z,1);
}
return 0;
35. }
int power(int x,int p){
int a[2*x];
for(int i=0;i<2*x;i++){
cin>>a[i];
if(a[i]%2==1)
p++;
}
return p;
}
int power(int x,int y,int p){
if(x==y)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
return 1;
}
36. #include <iostream>
using namespace std;
class AccBalance{
public:
AccBalance(){cout<<"Zero Balance"<<endl;}
AccBalance(int balance){
if(balance<0)
cout<<"Has a Negative Balance";
else if(balance==0)
cout<<"Has a Zero Balance";
else
cout<<"Has a Positive Balance";
}
};
int main()
{
AccBalance defltBal;
int balance;
cin>>balance;
AccBalance currBal(balance);
return 0;
}
37. #include <iostream>
using namespace std;
class Country{
public:
Country(){cout<<"Country:INDIA"<<endl;}
Country(char statename[100],int area,int density)
{
cout<<"State:"<<statename<<endl<<"Area:"<<area<<endl<<"Density:"<<density<<endl;
}
};
int main()
{
Country country;
char statename[100];
int area,density;
cin>>statename>>area>>density;
Country statesofindia(statename,area,density);
return 0;
66. #include <iostream>
using namespace std;
class teacher{
public:
int num;
void setdata(int n)
{
if(n==1)
num=10;
else
num=7;
}
void setdata2(int n)
{
if(n==2)
num=3;
else
num=8;
67. }
void tentable(){
for(int i=1;i<=10;i++)
cout<<num<<"*"<<i<<"="<<num*i<<endl;
}
};
class ten:public teacher{
};
class three:public teacher{
};
class eight:public teacher{
};
class seven:public teacher{
};
int main()
{
int n;
cin>>n;
teacher t;
if(n==1 || n==4)
t.setdata(n);
if(n==2 || n==3)
t.setdata2(n);
t.tentable();
return 0;
}
Abstract Class and Virtual Functions:-
68. #include <iostream>
using namespace std;
class School{
public:
int roll;
string name;
virtual void getdata(){};
virtual void display(){};
};
class District : public School{
void getdata();
void display();
};
void District :: getdata(){
cin>>roll>>name;
}
void District :: display(){
cout<<"Student Name is: "<<name<<endl<<"Student Roll no is: "<<roll;
}
69. int main()
{
District obj;
School* ptr;
ptr = &obj;
ptr -> getdata();
ptr -> display();
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int a,b,c,d,i;
class Holiday{
public:virtual void Expenses()=0;
};
class Citizen:public Holiday{
public:
void Expenses(){
70. cin>>c;
for (i=0; i<c; i++){
cin>>a;
if (d<a) d=a;
b=b+a;
}
cout<<d*c-b;
}
};
int main (){
Citizen obj;
obj.Expenses();
return 0;
}
#include <bits/stdc++.h>
71. using namespace std;
class Employees{
public:virtual void BuyingGame()=0;
};
class Reward:public Employees{
public:
int n;
void BuyingGame(){
cin>>n;
cout<<n - n / 2 - n / 3 - n / 5 - n / 7
+ n / 6 + n / 10 + n / 14 + n / 15 + n / 21 + n / 35
- n / 30 - n / 42 - n / 70 - n / 105 + n / 210;
}
};
int main()
{
Reward obj;
obj.BuyingGame();
return 0;
}
72. #include <iostream>
using namespace std;
class Employee{
public:
int s1,s2;
};
class Developer : public Employee{
public:
void getSalary(){
cin>>s1;
cout<<"Salary of Developer:"<<s1<<endl;
}
};
class Driver : public Employee{
public:
void getSalary(){
cin>>s2;
cout<<"Salary of Driver:"<<s2<<endl;
}
73. };
int main()
{
Developer d1;
Driver d2;
d1.getSalary();
d2.getSalary();
return 0;
}
#include <iostream>
using namespace std;
class consumer{
public:
string name;
virtual void getdata()=0;
virtual void display()=0;
};
class transaction: public consumer{
75. #include<iostream>
using namespace std;
class Problem {
public:virtual void Divisor()=0;
};
class Calculation:public Problem{
public:
int n,k,i;
void Divisor(){
cin>>n>>k;
}
int Display()
{
int count;
for(i=1;i<=n;++i)
{
if(n%i==0)
{
count++;
96. #include <iostream>
using namespace std;
int main()
{
int donuts,milk;
try{
cin>>donuts;
cin>>milk;
if(milk==0)
throw donuts;
else
cout<<"You have "<<(float)donuts/milk<<" donuts for each glass of milk";
}
catch(int e){
cout<<e<<" donuts and No MilknGo buy some milk";
}
return 0;
}
97. #include <iostream>
#include <math.h>
using namespace std;
int main()
{
int a;
try {
cin>>a;
if (a>0 && a<=100)
cout<<"Valid Mark";
else
throw "e";
}
catch(const char* t){
cout<<"Invalid Mark";
}
}
98. #include <bits/stdc++.h>
using namespace std;
int main()
{
int unitconsumed,costperunit;
try{
cin>>unitconsumed;
cin>>costperunit;
long int res;
res=pow(unitconsumed,costperunit);
if(cin){
cout<<res;
}
else
throw 0;
}
catch(int unit){
cout<<"Incomplete Data";
}
return 0;
}
99. #include <iostream>
using namespace std;
int main()
{
int n,m,a;
try{
cin>>n>>m>>a;
if(cin){
cout<<((n+a-1)/a)*((m+a-1)/a);
}
else
throw 0;
}
catch(int dimension){
cout<<"Invalid Dimension";
}
return 0;
}
100. #include<bits/stdc++.h>
#define f(i,a,n) for(i=a;i<n;i++)
using namespace std;
int main(){
int t,i,j;
cin>>t;
string str;
f(j,0,t){
f(i,0,2){
try{
cin>>str[i];
if(isalpha(str[i]))
cout<<str[i]<<" is alphabetic"<<endl;
else
throw str[i];
}
catch (char f){
cout<<f<<" is not alphabetic"<<endl;
}
}
}
}
101. #include <iostream>
using namespace std;
int main()
{
int a,b,c;
try{
cin>>a>>b>>c;
if(cin){
cout<<2*(a*b+b*c+c*a);
}
else
throw 0;
}
catch(int objectinfo){
cout<<"Incomplete information about the object";
}
return 0;
}
102. STL:-
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N, a, b;
while (cin>>N) {
vector<pair<int,pair<int,int>>>StorageDrives;
for (int i = 0; i < N; i++) {
cin>>a>>b;
StorageDrives.push_back(make_pair((b>a) ? a : 2000000001-b, make_pair(a, b)));
}
long long ret = 0, cap = 0;
sort(StorageDrives.begin(),StorageDrives.end());
int z=StorageDrives.size();
for (int i = 0; i < z; i++) {
if (cap < StorageDrives[i].second.first) {
103. ret += StorageDrives[i].second.first - cap;
cap = StorageDrives[i].second.first;
}
cap += StorageDrives[i].second.second - StorageDrives[i].second.first;
}
cout << ret << endl;
}
}
#include<bits/stdc++.h>
using namespace std;
int n,m,sx=99999,sy=99999,x,y;
char a[55][55];
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
if(a[i][j]=='*'){
x=max(x,i),y=max(y,j),sx=min(sx,i),sy=min(sy,j);
}
104. }
}
for(int i=sx;i<=x;i++){
for(int j=sy;j<=y;j++) cout<<a[i][j];
cout<<endl;
}
return 0;
cout<<"vector<vector<char>>drawing(n,vector<char>(m,'0')); drawing[row][col]";
}
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=55;
LL n, k, v, idx;
string name[N];
int main(){
LL t; cin>>t; while(t--){
cin>>n>>k>>v;
for(int i=0; i<n; i++)
cin>>name[i];
LL st=((v-1)*k)%n;
116. #include <iostream>
using namespace std;
class Person{
};
class Teaching : public Person{
};
class Instructor : public Teaching{
public:
int id;
string name,group,staff;
void accept_instructor_details(){
cin>>id>>name>>group>>staff;
}
void display_instructor_details(){
cout<<"Id:"<<id<<endl;
cout<<"Name:"<<name<<endl;
cout<<"Group:"<<group<<endl;
cout<<"Staff:"<<staff<<endl;
}
};
int main()
{
int n;