final notes part a Flashcards
(35 cards)
File Write Name Program Key Information:
-offstream-:aisle location]
-.open going tothe begining of next file
-txt file name
-output going to file to redress it where it is redsides
-\n without it we don’t know where to read it
Fstream:
able to get information from the file to the keyboard
ofrstream
outfile
string
Strings are used for storing text.
ifstream
infile
recursion
Recursion in C++ is a technique in which a function calls itself repeatedly until a given condition is satisfied. In other words, recursion is the process of solving a problem by breaking it down into smaller, simpler sub-problems.
base case
is a piece of code that allows us to end a recursive function
binarySearch() is a recursive function
that is used to find the required element in the array using binary search. The …
struct
Structures (also called structs) are a way to group several related variables into one place. Each variable in the structure is known as a member of the structure.
Unlike an array, a structure can contain many different data types (int, string, bool, etc.).
cmath
for the pow function
Adresses
-declare a variable(25)
-populate with a number(5)
-&x shows the adress display it
ctsd libary allows you ti
clear a system
pointer variable:
-memory adress
-it points to some piece of data that is stored in the comput
ers memory
-manipulate x (abc)
int variable
hold intergers
double var
hold floating point numbers
2d array
-2-d arrays can be defiined as an array of arrays
it can also represents a matrix
each element represent as Arr[row][column], where Arr[][] is the 2d array
parrell array
is a structure that contains multiple arrays. Each of these arrays are of the same size and the array elements are related to each other. All the elements in a parallel array represent a common entity.
employee_name = { Harry, Sally, Mark, Frank, Judy }
employee_salary = {10000, 5000, 20000, 12000, 5000}
array sequential search
Sequential search in C++ is also called a linear search. This searching technique is very simple, to perform this technique the user starts the loop from the zero index of an array to the last index of an array. It starts from the first index and compared the required value with the first value.
If the required value is found it will show the result otherwise compare the value of next index and it will continue until the required value is found or loop completes without finding any value.
array bubble sort
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order. This algorithm is not suitable for large data sets as its average and worst-case time complexity is quite high.
array binary search
Binary Search is defined as a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the information that the array is sorted and reduce the time complexity to O(
do while loop
-The do/while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true.
-The example below uses a do/while loop. The loop will always be executed at least once, even if the condition is false, because the code block is executed before the condition is tested:
continue y/n
char choice =’y’
while(choice==’y’||choice ==’y’)
reference
A reference variable provides a new name to an existing variable. It is dereferenced implicitly and does not need the dereferencing operator * to retrieve the value referenced.
functions layout
declare,dacall,define