Posts

Showing posts from May, 2020

Play Pong with 2 balls

Image
QxCoding Play Reset

What is the difference between a Vector and an Array. Discuss the advantages and disadvantages of both?

Image
Differences between a Vector and an Array - A vector is a dynamic array, whose size can be increased, where as an array size can not be changed. - Reserve space can be given for vector, where as for arrays can not. - A vector is a class where as an array is not. - Vectors can store any type of objects, where as an array can store only homogeneous values. Advantages of Arrays: - Arrays supports efficient random access to the members. - It is easy to sort an array. - They are more appropriate for storing fixed number of elements Disadvantages of Arrays: - Elements can not be deleted - Dynamic creation of arrays is not possible - Multiple data types can not be stored Advantages of Vector: - Size of the vector can be changed - Multiple objects can be stored - Elements can be deleted from a vector Disadvantages of Vector: - A vector is an object, memory consumption is more.   if any doubts or queries please comment 

Demonstration of new data types using structures

Image
What is a structure? A structure is a user defined data type in C/C++. A structure creates a data type that can be used to group items of possibly different types into a single type. How to create a structure? ‘struct’ keyword is used to create a structure. Following is an example. the below example demonstrates the creation of new data type point which can store coordinates : // A variable declaration with structure declaration. struct Point { int x, y; } p1; // The variable p1 is declared with 'Point' for using the above structure we need to use structure_name (.) member access operator followed by a member name of defined structure. int main() { // A valid initialization. member x gets value 0 and y // gets value 1. The order of declaration is followed. struct Point p1 = {0, 1}; cout<<"value of x="<<p1.x<<"value of y="<<p1.y; }   if any doubts or queries please comment 

c++ typing speed tester project using graphics.h header file

Image
INTRODUCTION I have made project “ Typing speed tester “. In this software we can test our speed and efficiency for typing via general keyboard. In this programme we have to type the characters which are displayed on the user screen. Now, coming to technical aspects of this software, all data are maintained in binary files, concepts of function and little bit use of graphical colours. LOGIN   INFORMATION USERNAME:    jatin PASSWORD:    password Header Files Ø iostream.h Ø dos.h Ø stdio.h Ø conio.h Ø time.h Ø string.h Ø stdlib.h Ø "tt.h" SOFTWARE RECQURIMENTS OS:             Windows Platform RAM :           512 MB Processor :   Pentium 3 or Above Compiler :     Turbo C++      or                       Borland C++ 4.5                                                                   OUTPUT                                        SOURCE CODE /* Project Name: Speed Tester

How to clear cache in python

Image
What is Caching? The process of  caching  enables storing of temporary data, the result of which is faster access, load times and speedier experience for the user. Deleting it makes the process to reload assets again. Why to remove cache? It is a good idea to clear your browser cache because it: prevents you from using old forms protects your personal information helps our applications run better on your computer Python code for clearing cache: ''' Clear cache files ''' import os if __name__=='__main__': outer = os.getcwd() cache = os.path.join(outer, 'cache') for f in os.listdir(cache): f = os.path.join(cache, f) os.remove(f) print("Removed {} files.".format(count)) if any doubts or queries please comment