Your ultimate guide in programming...

  • Infix to Postfix Converstion

    * C++ implementation to convert infix expression to postfix*

  • DOUBLY QUEUE IMPLEMENTATION C++

    Double Queue Implemention Guide.

  • Data Structures in JavaScript

    As business logic moves from the back to the front, expertise in front-end engineering becomes even more important. As for front-end engineers, we rely on viable libraries to be effective.

  • Coding Problem To Solve Exercise 1

    here is Some Coding Problem For Beginners To Boost up their Confidence and to get grip on programming. This problem is for beginner levels for their brainstorming.

  • Coding Problem To Solve Exercise 2

    here is Some Coding Problem For Beginners To Boost up their Confidence and to get grip on programming. This problem is for beginner levels for their brainstorming.

  • Coding Problem To Solve Exercise 3

    * here is Some Coding Problem For Beginners To Boost up their Confidence and to get grip on programming. This problem is for beginner levels for their brainstorming.*

Coding Problem To Solve Exercise 3

 


             Coding Problem To Solve Exercise 3

Objectives:

  • Practice and understanding of basic c++ programs
  • Control Structure(repetition)
  • While loop statement
  • The counter management loop variable
  • Sentinel controlled loop
  • Flag controlled loop
  • For loop
  • Do-while loop
  • Break and continue statement
  • Pre and post-increment/ decrement operator


Problem: 1 do-while, switch case

Write software that offers the person the opportunity of 5 preferred beverages (Coke, Fanta, Sprite,
Pepsi, mineral water) then allow the person to determine a nutrient via way of means of entering into range 1-5.
The output that nutrient they chose. User will offer choices until he/she has coins in his/her
account and display message “out of money” with ultimate stability as soon as a person has not
sufficient coins to buy a minimal price drink (You have to use a transfer statement).

Note:
1. price of each drink is completely unique and larger than zero (You will initialize prices).
2. Input Balance from a person.
3. Input stability has to be larger than a minimal price drink.
4. whilst a person enters his/her opportunity both he/she desire to buy a drink or not (use bool
statistics type).
5. display a variety of beverages with ultimate stability if the person didn't desire to buy a drink or
out of stability.


Problem: 3 do-while

White an application that discovers the Lest Common Multiple to get enters the last two digits of your Roll numbers from the user.

Hint: LCM of  integers a and b is the smallest superb integer this is divisible with the aid of using
each a and b.

                                       Problem: 4 do-while
White a software that discovers the Highest Common Factor through getting enter of the last two digits of your Roll number from the user.

 For Example

Hint: The biggest integer that can flawlessly divide  integers is referred to as HCF of these 
numbers.


Problem: 4

A university has 2000 college students and 2000 lockers, one locker for every scholar. The major perform the recreation:
he asks the primary scholar to head and open all of the lockers. he then asks the second scholar to head and near all of the even-numbered lockers. The 1/3 scholar is requested to test each 1/3 locker.
If it's far open, the scholar closes it; if it's far closed, the scholar opens it. The fourth scholar is requested to test each fourth locker. If it's far open, the scholar closes it; if it's far closed, the scholar opens
it. The last college students retain this recreation. In general, the nth scholar tests each nth
locker. If the locker is open, the scholar closes it, if it's far closed, the scholar opens it. After all of the college students have taken their turn, a number of the lockers are open and a few are closed.
Write an application that activates the consumer to go into the variety of lockers in a university. After the
recreation is over, this system outputs the variety of lockers that can be opened. Test run your application for the subsequent inputs: 2000, 5000, 10000. Do you notice any sample developing?

Hint:    Consider locker variety 100. This locker is visited with the aid of using scholar numbers 1, 2, 4, 5, 10, 20,
25, 50, and 100. These are the effective divisors of 100. Similarly, locker variety 30 is visited with the aid of using scholar numbers 1, 2, 3, 5, 6, 10, 15, and 30. Notice that if the variety of effective divisors of a
locker variety is odd, then on the cease of the recreation, the locker is opened. If the
variety of effective divisors of a locker variety is even, then on the cease of the recreation, the locker
is closed.























Share:

Coding Problem To Solve Exercise 2



Coding Problem To Solve Exercise 2


        Here is Some Coding Problem For Beginners To Boost up their Confidence and to get grip on programming. This problem is for beginner levels for their brainstorming. 


Note: When you are done with a question then post your answer this will be good for others to start and for your to correct your mistakes. 



Let's Get Start Your Solving Problem Journey with programminginterest1


    1. Write a program that obtains marks in the entry test. If obtained marks are greater than 80 then display “You can get admission is Fast” otherwise “Sorry you did not get admission. Please try next time”

 Note: Use if-else without curly brackets. 

    2. Write a program that obtains a temperature in degrees Fahrenheit from the user. If the temperature is 80 degrees or more, displays a message that says, “Weather is perfect for playing cricket " otherwise displays a message stating "Don’t go outside, the weather is too cold”. 

Note: Use if-else without curly brackets. 

    3. Suppose there is a cricket match between Pakistan and India. India played first and gave a target of 300 runs to Pakistan. Now write a program that obtains a cricket match score and remaining wickets from the user. If the user is greater than 300 outputs a message indicating “Pakistan win the match by X wickets” while X is remaining wickets. Otherwise shows a message of how many remaining runs required to win with X wickets in hand. Use a single if-else statement. If the score is 300 with 0 wickets in hand then the display match is drawn. 

Note: Score and wickets are not less than zero 

    4. Write a program that obtains a name and age from the user. If the user is 18 or older, outputs a message indicating they are old enough to drive with a username. For people under 18, outputs a message indicating how many years they must wait before they can drive legally with a username. Use a single if-else statement.

    5. Write a program that inputs a mark out of 100 from the user and displays his/her grades. a. If marks are greater than 80 display “You got A grade” b. If marks are greater than 50 display “You got B grade” c. If marks are greater than 40 display “You got C grade” d. If marks are below 40 display “You got F grade”

Note: Number must be 1 to 100 otherwise display invalid number. 

    6. Write a program that inputs a number from the user from 1 to 7 and displays the name of the weekday. Such as Enter number: 1 Its Tuesday Note: Number must be 1 to 7 otherwise display invalid number. 

    7. The following program contains errors. Correct them so that the program will run and mention reason of error if any.




Share:

Coding Problem To Solve Exercise 1


Solve Problems To Solve Real-World Problems

 

1)  Write a program to display "Hello World"

 2.)   Add and display three numbers without using a variable.

 3). Write a program, which asks the user to input a number. Then display it. 

4.) Finding the average of three numbers. 

5) Write a program to display the following output using a single cout statement Subject Marks Mathematics 80 

Computer 77

 Physics 70 

6 ) Write a program, which displays the value of “π”, then inputs the radius of a circle from the user and displays its area and circumference. Note: You will have to declare a variable for “π” named as “pi” yourself and initialize it the value 22/7. Area = 𝝅𝒓 𝟐 Circumference = 2πr 

7) Write a program to calculate the area and perimeter of the square.

 8) Write a program to calculate the interest of the bank deposit (formula interest= amount*years*rate/100). 

9) Write a program to input/get a number of float types from the user and then show this number as both floats with decimal points and integer without decimal points. 

10) Write a program, which asks the user to enter two numbers, and then output them after Objectives: • Practice and understanding on basic C++ programs swapping their values using the third variable

OUTPUT-:

Enter the variable "a" = 5

Enter the variable "b" = 6

Before Swapping

Value in the variable "a" = 5

Value in the variable "b" = 6

After Swapping

Value in the variable "a" = 6

Value in the variable "b" = 5


11) Write a program to swap the value of two variables without using a third variable.

Clue: Use arithmetic operators such as division ‘/’ and multiplication * or addition + and subtraction


12) Write a program to Convert Temperature from Fahrenheit (℉) to Celsius (℃) 

(formula C=5/9*(F-32)) 

13) Write a program to calculate the quotient and remainder. Use proper names of variables a. divisor b. dividend c. quotient d. remainder

Share:

Data Structures in JavaScript

 

Data Structures in JavaScript

Introduction

 

        As business logic moves from the back to the front, expertise in front-end engineering becomes even more important. As for front-end engineers, we rely on viable libraries to be effective. Libraries rely on state libraries such as Redux for data management. Together, Reaction and Redux subscribed to the reactive programming paradigm in which UI updates react to data changes. Fast forward, the backend only serves as the API's server, providing only point-of-use to retrieve and update data. In effect, the frontend engineer expects the frontend engineer to handle all controller logic. The growing popularity of microServices and GraphQL confirms this growing trend.                                                                                                                                                   

        In addition to having an aesthetic understanding of HTML and CSS, frontend engineers are also expected to master JavaScript. As the client's data stores become "copies" of the database on the server, the intimate knowledge of the idiomatic data structure becomes important. In fact, an engineer's level of experience can be used to gauge when and why a particular data structure should be used. Now, in a                                                                                                                     

Worried about bad programmer code. Good programmers care about data structures and their relationships.

 

                                - Creator of Lens Torvalds, Linux, and Gut.

 

        At the top level, there are basically three types of data structures. Stacks and rows are array-like structures that differ only in that items are inserted and deleted. Attached lists, trees, and graphs are structures that are attached to nodes that refer to other nodes. Hash tables rely on hash functions to save and search for data.

        In terms of complexity, stacks and rows are the simplest and can be built from LinkedIn. Trees and graphs are the most complex because they enhance the concept of an attached list. Hash tables need to use these data structures to perform satisfactorily. In terms of performance, LinkedIn lists are best suited for recording and storing data, while hash tables perform best for finding and retrieving data.

        To explain why and how this article will be based on the order of dependence. 

 

                                                                    Let's get started!  

Stack

            The most important stack with arguments in JavaScript is the call stack where we always act within the scope of a function. Programmatically, it's just a row with two rows of actions: push and pop. Push adds elements to the top of the array, while pop removes them from the space. In other words, the stacks follow the "List In, First Out" protocol (LIFO).


Queue 

        JavaScript is a program-driven programming language that makes it possible to support blocking operations. Internally, the browser manages only one thread to run the entire JavaScript code, uses the event queue to bring listeners to the queue and the event loop to listen to the registered events. To support Christianity in a single-thread environment (to save CPU resources and enhance the web experience), listeners deserve action and only execute when the call stack is empty.                                                                                            

        Promises depend on this event-driven architecture to allow a “synchronous-style” execution of asynchronous code that does not block other operations.

Programmatically, rows are just rows with two basic functions: non-shift and pop. In shift moves the signal to the end of the array, while pop makes them deserving from the beginning of the array. In other words, the queue follows the "first in, first out" protocol (FIFO). If the direction is reversed, we can change the inset and pop with push and shift, respectively.

 

PLEASE COMMENT TO ABOUT THE BLOG AND SHARE YOUR CODING EXPERIENCES WITH US AT asadsiddique.a@gmail.com



Share:

Want to learn web development but don’t know where to start?

 



تو ، کیا آپ ویب ڈویلپمنٹ سیکھنے اور ویب ڈویلپر بننے میں دلچسپی                                         رکھتے ہیں؟

 سب سے پہلے ، مبارکباد۔ آپ نے ایک بہت اچھا انتخاب کیا 





اور چونکہ آپ یہ پڑھ رہے ہیں ، آپ پہلے ہی کسی فیس بک گروپ ، سبریڈیٹ یا دیگر آن لائن کوڈنگ کمیونٹی کے ایک سرگرم رکن ہوسکتے ہیں۔ جو شروع کرنے کے لئے اور آپ کے منتخب کردہ تعاقب میں مدد حاصل کرنے کے لئے ایک بہترین جگہ ہے۔

ایک بار پھر ، آپ ابھی تک بہت اچھا کر رہے ہیں۔

لہذا آپ کے پس منظر پر انحصار کرتے ہوئے ، آپ سوچ رہے ہوں گے کہ ویب ڈویلپمنٹ کو کہاں سے سیکھنا شروع کریں۔ اگر آپ بنیادی طور پر ادھر ادھر ادھر ادھر ادھر گھوم رہے ہیں تو ، آپ کو وہاں کی تمام زبانوں ، فریم ورکوں اور سیکھنے کے وسائل سے تھوڑا سا مغلوب ہوسکتا ہے۔

ٹھیک ہے ، فکر نہ کرو۔ تم اکیلے نہیں ہو. گوگل آپ کا سب سے اچھا دوست یا آپ کا بدترین دشمن ہوسکتا ہے۔ یہ صرف اس پر منحصر ہے کہ آپ اسے کس طرح استعمال کرتے ہیں۔


                                                    اختتام کو دھیان میں رکھیں۔

ویب ڈویلپمنٹ کو سیکھنے کے وقت شروع کرنے کے دوران میں سب سے پہلے جن چیزوں کی تجویز کرتا ہوں ان میں سے ایک یہ ہے کہ کسی واضح مقصد کا فیصلہ کریں ، اور اسے ذہن میں رکھیں۔

ہوسکتا ہے کہ آپ کیریئر میں تبدیلی لانا چاہتے ہو۔ ہوسکتا ہے کہ آپ کو کسی ایپ کے لئے غلط خیال ہو۔ یا ہوسکتا ہے کہ آپ صرف تفریح​​کے سیکھنا چاہتے ہو۔

آپ کا مقصد جو بھی ہو ، یہ سمجھنا ضروری ہے کہ آپ یہ کیوں کر رہے ہیں۔ یہ تفہیم آپ کو سیکھنے کے وقت کے ساتھ زیادہ کارآمد ہونے میں مدد دے گی۔ جب آپ ہار ماننے کو محسوس کریں گے تو ان اوقات میں آپ کی حوصلہ افزائی کرنے میں بھی مدد ملے گی۔

یاد رکھنا ، قطع نظر اس بات سے قطع نظر کہ اب حتمی مقصد کتنا وسیع اور دور دکھائی دے سکتا ہے ، آپ اسے سخت محنت اور استقامت کے ساتھ حاصل کرسکتے ہیں۔

فرض کریں کہ آپ کے پاس کوئی پچھلا تجربہ نہیں ہے ، شروعات میں یہ فیصلہ کرنا ایک اچھا خیال ہے کہ کیا آپ کی دلچسپی بیک سینڈ یا فرنٹ اینڈ ڈویلپمنٹ میں ہے۔ میں فرق کو مختصر طور پر بیان کرتا ہوں۔


                                                       فرنٹ اینڈ

آخر صارف یہی دیکھتا ہے اور اس صفحے پر بات چیت کرتا ہے۔ اس کے سارے ڈیزائن ، فینسی اثرات ، ترتیب اور منظر کشی جو صارف کا تجربہ تخلیق کرتی ہے۔

عام طور پر فرنٹ اینڈ ڈویلپرز بہترین ڈیزائن کی مہارت اور قابل رسائ اور صارف کے تجربے کے جذبے کے ساتھ بصری تخلیقات ہوں گے۔ اکثر فرنٹ اینڈ ویب ڈویلپمنٹ کے ساتھ وابستہ ٹیکنالوجیز HTML ، CSS ، jQuery اور جاوا اسکرپٹ ہیں۔

                                    

                                                                Backend


یہ وہ حصہ ہے جو عام طور پر ڈیٹا کو پروسس ، اسٹور اور جوڑتوڑ کرتا ہے۔ ویب سائٹ یا درخواست کام کرنے کا طریقہ یہ ہے۔ بیک اینڈ ڈویلپر عام طور پر اچھ مسئلے حل کرنے والے ، منطقی مفکرین ہوتے ہیں جو کسی ویب سائٹ یا ایپلی کیشن کی فعالیت میں دلچسپی رکھتے ہیں۔ بیک اینڈ ڈویلپمنٹ عام طور پر پی ایچ پی ، ازگر اور روبی جیسی سرور کی زبانوں سے وابستہ ہوتا ہے۔

میں بالکل دور سے ہی جانتا تھا کہ میرے پاس ابھی بصری ڈیزائن کے لئے ایسا شعلہ نہیں تھا جو بہت سارے ڈویلپرز کو فرنٹ اینڈ ڈویلپمنٹ کی طرف راغب کرتا ہے۔ انجینئرنگ اور تعمیرات میں میرے پس منظر کی وجہ سے مجھے شاید یہ فیصلہ سب سے زیادہ آسان معلوم ہوا۔ میں مسئلہ کو حل کرنے میں قدرتی طور پر زیادہ مشابہ ہوں ، اور یہ معلوم کرنے کی کہ چیزیں کس طرح کام کرتی ہیں ، چیزوں کو خوبصورت لگانے سے!

کسی بھی طرح سے ، جہاں بھی آپ کی دلچسپی مضمر ہے ، میں اب بھی سوچتا ہوں کہ شروع کرنے کا بہترین مقام کچھ بنیادی HTML اور CSS کو سیکھنا ہے۔ بہرحال ، اس سے کوئی فرق نہیں پڑتا ہے کہ ترقی کے کس شعبے میں آپ آخر کار کام کرنا چاہتے ہیں ، آپ کو ابھی بھی کسی بھی طرح کی ہلکی سی شکل میں ویب پیج پر ظاہر کرنے کے اہل ہونے کی ضرورت ہے۔

سب سے پہلے سب سے پہلے ، براہ راست فری کوڈکیمپ یا کوڈکیڈیمی کی طرف بڑھیں اور ان کے "HTML اور CSS" کورس لیں۔ اس سے آپ کو یہ احساس دلانا چاہئے کہ ان ٹیکنالوجیز کے بارے میں کیا ہے۔

نیز ، ان کے انٹرایکٹو سیکھنے کے ماحول کی وجہ سے ، وہ آپ کو مقامی ترقیاتی ماحول کو پہلے ترتیب دینے کا طریقہ معلوم کرنے کی بجائے ، آپ کو سیدھے کوڈ لکھنا شروع کردیں گے۔ کچھ کوڈ لکھنے اور کچھ ٹیسٹ فورا. پاس کرنے کے علاوہ آپ کے اعتماد کو مزید تقویت نہیں ملے گی۔


Share:

DOUBLY QUEUE IMPLEMENTATION C++

DOUBLY QUEUE IMPLEMENTATION C++


// DOUBLY QUEUE IMPLEMENTATION
#include<iostream>
using namespace std;
struct Node{ //NODE STRUCTURE
Node *prev;
int data;
Node *next;
};
class Doubly_Queue{ //DOUBLY_QUEUE CLASS
Node *front;
Node *rear;
public:
Doubly_Queue()
{
front = NULL;
rear = NULL;
}
void insertion(int x) //INSERTION FUNCTION
{
Node *ptr = new Node;
ptr->data = x;
if(rear == NULL)
{
ptr->prev = NULL;
ptr->next = NULL;
rear = ptr;
front = ptr;
}
else
{
rear->next = ptr;
ptr->prev = rear;
ptr->next = NULL;
rear = ptr;
}

}
int remove() // REMOVE OR DELETE FUNCTION
{
int copy = front->data;
Node *rptr = front;
front = front->next;
if(front == NULL)
{
rear = NULL;
}
delete rptr;
return copy;
}
void previous() // PERVIOUS VALUES DISPLAYING FUNCTION
{
Node *curr = rear;
while(curr != NULL)
{
cout<<curr->data<<" ";
curr = curr->prev;
}
}
void display() // NORMAL DISPLAY FUNCTOIN
{
Node *curr = front;
while(curr != NULL)
{
cout<<curr->data<<" ";
curr = curr->next;
}
}
};
// MAIN DRIVEN...
int main()
{
Doubly_Queue q; // OBJECT OF CLASS
char choice;
do{
int input;
cout<<"1) TO INSERT: \n";
cout<<"2) TO REMOVE: \n";
cout<<"3) FOR PREVIOUS DISPLAY: \n";
cout<<"4) FOR NORMAL DISPLAYING: ";
cin>>input;
system("clear");
switch (input)
{
case 1:
int num;
cout<<"ENTER NUMBER TO INSERT :";
cin>>num;
q.insertion(num);
break;
case 2:{
cout<<"REMOVED NUMBER IS: "<<q.remove()<<endl;
break;
}
case 3:{
q.previous();
break;
}
case 4:{
q.display();
break;
}
default:
cout<<"ERROR 404: ";
break;
}
cout<<"DO YOU WANT TO MORE: (Y/N)...";
cin>>choice;
system("clear");
}while(choice == 'y');
return 0;

}

Share:

Queue Using Linked List c++


#include<iostream>
using namespace std;
struct Node{
int data;
Node *next;
};
class Queue_Linklist{
Node *front;
Node *rear;
public:
Queue_Linklist(){
rear = front = NULL;
}
void insert(int num){
Node *temp = new Node;
temp->data = num;
temp->next = NULL;
if(rear == NULL){
rear = temp;
front = temp;
}
else{
rear->next = temp;
rear = temp;
}
}
int remove(){
int copy = front->data;     
Node *del = front;
front = front->next;
if(front == NULL){
rear = NULL;
}
delete del;
return copy;
}
void Display()
{
Node *temp = front;
cout<<"DATA IN QUEUE IS: ";
while(temp != NULL){
cout<<temp->data<<" ";
temp = temp->next;
}
}
};
int main()
{
Queue_Linklist Q;
char choice;
do{
int input;
cout<<"1) TO INSERT NUMBER: \n";
cout<<"2) TO REMOVE NUMBER: \n";
cout<<"33) TO DISPLAY QUEUE: ";
cin>>input;
system("cls");
switch(input){
case 1:{
int num;
cout<<"ENTER NUMBER: ";
cin>>num;
Q.insert(num);
break;
}
case 2:{
cout<<"REMOVED NUMBER IS: "<<Q.remove()<<endl;
break;
}
case 3:{
Q.Display();
break;
}
default:{
cout<<"EROR 404: "<<endl;
break;
}
}
cout<<"\nDO YOU WANT TO CONT...(Y/N)...";
cin>>choice;
system("cls");
}while(choice == 'y');
return 0;
}

Share:

Newest Post

Coding Problem To Solve Exercise 3

                   Coding Problem To Solve Exercise 3 Objectives: Practice and understanding of basic c++ programs Control Structure(repetit...

Popular Posts

Recent Posts