@usamashafiq
  • Stars
    star
    5
  • Global Rank 1,429,440 (Top 50 %)
  • Followers 13
  • Following 100
  • Registered over 5 years ago
  • Most used languages
    C++
    75.0 %
    Python
    25.0 %
  • Location 🇵🇰 Pakistan
  • Country Ranking
    C++
    306
    Python
    1,765

Top repositories

1

Cellular-companies-save-Call-details-records-CDR-for-each-call

Cellular companies save Call details records (CDR) for each call. Some of the data of calls made in 2018 year in Gukkhar are given file “cdr.txt”. The file has caller no, callee number, date of call, duration of call. This file has 10lacks records. File has data in the following format. Callerno calleeno day month year hours minutes second o *Write a structure CDR to hold a single record o *Write a function print that accepts a CDR and print it on screen in a row o *Write a function show_all the accept nothing open “cdr.txt” in read mode and read record one by one and use the above print function to print all the records on scree o *Write main function and call show_all method to check o Write a function readf that accept an array of CDR of size N. Read first N records from the file into that array. o Modify the main function and declare and array of size 10 of CDR, call the readf function and pass this array o Write a function writef that accepts an array of CDR of size N and write the array contents to the file “f10.txt” omitting the call status field. o Modify the main and call writef on the array in which data is already been stored. Open the “f10.txt” file to confirm o *Write a function printHTML that accept a callerno, write all calling record of that caller to a new file named “caller.txt”. Test this function to filter calls made by “03090061389". o Write a function countCalls that accepts a callerno and return how many calles are made by this caller no. Test this function to count calls by “03090061389" you must have 6758 call records. o *Write a function Delete that accept an int (record no) and delete that record from the original file. Modify the main function to delete 3rd record. Before and after call show_all function to confirm 2. Write a program that read MCQ questions from the file and ask these question form user, get the answer and calculate the score. Use functional approach with array of structure instance to accomplish the task. Write the wrong answered questions to a new HTML file that can be opened in browser. MCQ questions are given in file “qbank.txt”. Open the file task2.cpp follow the below sequence. Analyze the file structure such that you can store data from file to the structure given below struct Mcq{ char question[300]; char answer[150]; char opt1[150]; char opt2[150]; char opt3[150]; char opt4[150]; } ; o Write main program that declare and array of 10 size of above structure. o Write a function readN that accepts array of Mcq and its size. Open the file for reading and read first size questions from file and put in array o Modify the main to call the readN and pass the created array o Write a function askQuestion that accept an instance of above structure and show question on the screen and ask the answer from user. Compare the answer of user and return true if user answered it correctly otherwise return false. Question: What is Capital of Pakistan? a) Karachi b) Quetta c) Lahore d) Islamabad o Modify the main to loop over the array and pass each element to askQuestion to count how many answer was correct. When user has answered all the questions than it should show score to user (each correct answer carry 2 marks) o Modify the above loop and if user answered a question incorrectly then write it to the HTML file in a new paragraph. o (do at home) print a certificate to the user in HTML showing his name, score etc 3. Save the library books record in a file. The record can be added anytime, can be modified, deleted or searched by book id. (we need to store id, title, author, pages, price of each book). You are given a sample data in file “collection.txt”. modify the code in task3.cpp o Write a function search that takes book id and search the record from the file and show it on screen. If record not fund it should handle that case. o Comment out the relevant lines in given main function, run to check o Write a function insert that take book structure and write the record at the end of the file. o Comment out the relevant lines in the main and run it to insert a record, then check it using search option o Write a function Delete that takes book id and delete that record form the file. o Comment out the relevant lines form main, delete the inserted record and then confirm deletion using search o Write a function modify that take a book structure instance. Modify that record with new values. o Comment out the relevant code in main, run and modify a record. Search it to confirm modification o Write a function that takes nothing, write all the records to the HTML reportHTML file “report.html” in a table where book pagers are above 400. o Comment out the relevant code in main, run and open the file in browser to confirm
C++
2
star
2

two-way-sign-language-translator-master

Python
1
star
3

find-shotest-path-priority-queue-structure-

Implement the given methods of priority queue structure using node structure and pointers a) Create node structure that can store strings b) Create PQueue class, declare data members as discussed and write constructor • Write main method and create a queue object c) Write display method that display the queue each element as DATA | PR. Take care of head & tail(it should not move or any other thing should not change) • Call this method in main to test d) Write add method that accept a string and priority number and place it at proper position. Handle all the cases and minimize the queue traversal. Properly adjust the pointers • Call this method in main to add Lahore | 2, Islamabad | 2, Karachi | 5, Multan | 9 in the queue, and display to confirm e) Write getHigestPriorityNo that accept nothing and return the highest priority value in the queue, if queue is empty than return 9999 • Call this method to check the highest priority in the queue f) Write getHigestPriorityValue that accept nothing and return the highest priority element from the queue, if queue is empty then return empty string • Call this method to check the highest priority element in the queue g) Write remove method that remove element with highest priority and return bool removed if element is removed. Implement the cases as discussed in theory. Properly take care of pointers (both head & tail). • Call this method in main to remove and element and display to confirm h) Write search method that accepts a string and return its position in the queue • Call this method to find Multan i) Write a method getPriority that accept a number and return the priority of element found at that position. If no such element the return 9999 • Call this method to find priority of element at 3rd position j) Write a method getValue that accept a number and return the element at that position. If no such element the return empty string • Call this method to find element at 3rd position k) Write size method that return number of elements in the queue • Call this method to determine queue size l) Implement the destructor of priority queue A tourist is traveling by car and wants to know the shortest path to its destination from a sub graph (see figure). He can’t travel long and have to take rest in between. Show him the path to destination such that he can visit the nearest city to take rest. Consider the cities as separate priority queue and select the local shortest path from each city to lead him to the destination.
C++
1
star
4

MCQ_TEST-IN-C-

*Create a structure that can store a MCQ. Following things need to be stored o Question o Four options for answer o Correct answer Create a mcq instance in main and store following data statically. Question: What is Capital of Pakistan? a) Karachi b) Quetta c) Lahore d) Islamabad  Correct answer: Islamabad Show Question and options in the format given. Prompt the user for the answer. Compare the user answer with correct answer and show correct/incorrect accordingly
C++
1
star