Category Archives: C Refresh

Algo DS: Circular Queue

 

code:

C++ STL in Bangla

https://tanvir002700.wordpress.com/2016/04/15/c-stl-tricks1/

 

Data Structure: Queue

Stack VS Queue difference:

 

code:

My implementation:

Another Video:

Code from the video Mycodeschool(Using circular queue):

 

Algorithm: BFS(Breadth First Search)

Theory:

http://scanftree.com/Data_Structure/Breadth-First-Search

Bangla:

গ্রাফ থিওরিতে হাতেখড়ি-৪(ব্রেডথ ফার্স্ট সার্চ)

Video:

code implementation:

Some other links may help:

Breadth First Search Algorithm

code:

Input:

Output:

Another code tried to write from the pseudocode is:

reference from java code: http://www.programmingboss.com/2014/06/breadth-first-search-bfs-in-java.html

ppt slide: https://drive.google.com/file/d/0B0sCkwd_qKgJSzZyUWVYZU5GWlk/edit

Struct Deep Example

code:

struct some other beautiful example:
code:

 

File Handling: Read Content From a Binary File

code:

 

File Handling: Formatted Data Reading and Writing Example

code:

 

File Handling: Fprintf Write Content to a File

code:

 

File Handling: Take formated input from textfile using fscanf() function

code:

output:

frmt.txt

 

Read Content From a File using Fgets

code:

 

Read Content from Text file using C

code:

 

File Handling in C

code:

 

Arguments from Command Line Console

code:

 

Problem 85: Product

Create a structure named Product with following two fields-

1. name (string)
2. price (double)

Then create a function named printProductInfo() which takes a parameter of Product type and print the information of that Product. Finally, in main function create a variable of structure Product named myProduct and call the printProductInfo() function passing myProduct as the parameter.
code:

 

Struct Problem 1: 101cproblems

Problem 81: Struct GPA

Create a simple structure named Student that holds the following variables-
i. id (integer)
ii. cgpa (float)
iii. name (string)
Now create an instance of that structure named s1 and scan the values from the user. Finally print the id, cgpa and name which user entered.

code:

Source:http://101cproblems.com/problem-81/

Another approach: