Skip to main content

Posts

Showing posts from January, 2019

C++ wala SQL (Project)(currently not complete)

//now posting as TECHY 3 ;-) //New- Database Capability (groundwork ready for that) // Further idea- Have an option to save the tables/databases in a database, or different databases //               Declare more classes to get 1 column, 2 column.. tables also, probably maximum 5 columns //               Have option to give/change Row names // Create unlimited number of tables in a database using Linked List // Maintain both, database with maximum 5 tables and database with more capabilities //Features to be depricated // Database with limitation of upto 5 tables //Programmer - Aditya Gupta #include<iostream> #include<stdlib.h> #include<string.h> //#include<fstream> // will be required when save in database supported using namespace std; void inline title(void){ system("cls"); cout<<"\tNAMASTE!...\n\nProgram-C++ wala SQL\nPrograammer - MR. ADITYA GUPTA (Techy15)\n\n"; } struct Node{ int dat1,d

AP, GP Generator (using Linked List)

//Future advancements-> add save as file, in text or in a database option (for the sequences) //                      add more series to this //Programmer - Aditya Gupta #include<iostream> #include<stdlib.h> #include<math.h> //#include<fstream> //reqd when save support is added to this! using namespace std; struct Node{ int data; Node* next; }; void inline title(void){ system("cls"); cout<<"\tNAMASTE!...\n\nProgram-AP,GP Generator\nPrograammer - MR. ADITYA GUPTA (TEChY 3)\n\n"; } class List{ //NOTE: I HAVE REMOVED ALL COMMENTS, REFER TO THE LINKED LIST TEMPLATE FOR DETAILED COMMENTS             //here only generator specific comments are there, and that too which are not in template Node *top,*rear; public: void Push(int dat); int isempty(); int search(int dat); int noofelements(); void Pop(); //CAUTION- will decrease number of terms by 1 each time it runs, and pushing the last element again will be same

Linked List Template

//This is just my own template for linked list (Stack and queus are just limitations which i dont want) //JUST A TEMPLATE CONTAINING MANY FUNCTIONS //Programmer - Aditya Gupta (now posting as TECHY3) #include<iostream> struct Node{   //single data nodes int dat; Node* next; }; //CAUTION-> DONT DECLARE 'TEMPORARY NODE' HERE, SINCE SOMEWHERE IN SOME LOOP IT MAY BE DELETED, AS WE DO IN POP class List{ Node *top,*rear; public: void Push(int dat); //pushes to end (last/rear) void Push(int dat, int loc); /*receives location also, for eg. if location passed as 5,                              then first use noofelements() to check whether it has at least 4 elements, then continues... to put given data at location 5, ie. initial 5th data becomes 6th*/ void tPush(int dat); //to push at top position *doesnt call push(int,int) since it will take more time int isempty(); //gives 1 if empty(ie true), and gives 0 if not empty (ie false) int search(int dat); //

Some interesting observations in C++

//I used Dev C++ Ver 5.11 (compiler) ... i told since some of this might run differently on other IDEs Some interesting observations in C++ ---------------------------------------- 1. About pow() function *pow() cant find 'fractional' powers, but can find decimal powers for eg. pow(4,1/2) gives 1; but, pow(4,0.5) gives 2;      pow(4,0.55) gives 2.14; *roots of negative numbers: pow(-4,0.5) gives "nan" 2. Time Battle between cout and for loop (UnExpEcTEd) In this program, see the time taken by them (individually) "on my computer" (on faster computers there may be more/less gap) #include<iostream> using namespace std; int main() { //for(int i=1; i<100000;i++);  //0.215 sec cout<<"hello";  //0.303 sec } 3. Dont ask user to enter 0, if you are going to use an IF statement, because 0 is treated as false; instead ask for -1 instead of 0 (*you may even as for any other number) For eg. cout<<"Enter 0 if