Tuesday, March 3, 2020

Excel Tutorials from Basic To Advanced

Nowadays, Excel has become an integral part of our day to day life. Whether you are an analyst, sales executive, project manager or technical architect, you need excel to perform a variety of functions ranging from rudimentary calculation to sophisticated dashboards. Excel makes your life easier and lets you store and organize financial data securely.

Click Here to Start Learning Excel

Wednesday, March 16, 2016

Stack Implementation using Linked List

Description:


We can implement stack using array as well as linked list. But array has fixed size therefore we prefer to use linked list because it does not have predefined size.


#include <iostream>
using namespace std;
struct Node{
int value;
Node *next;

};

int main(){

for( int i=0;i<=79;i++){
cout<<'*';
}
cout<<"                     Built & Designed by Arslan Malik Aareez"<<endl;
cout<<"                          www.CWorldbyAS.blogspot.com"<<endl;
cout<<"                     Facebook : www.facebook.com/arslan.ud.din"<<endl;
cout<<"                     Twitter  : www.twitter.com/itsaareez"<<endl;
for( int i=0;i<=79;i++){
cout<<'*';
}

int menu;
int sel;
 
struct Node *p = new Node;
struct Node *head = new Node;
struct Node *r = new Node;
head->next = NULL;
head->value=0;
    ask:
cout<<"Enter Your Choice\n"<<endl;
    cout<<"1. Push"<<endl;
    cout<<"2. Pop"<<endl;
    cout<<"3. Print"<<endl;
    cout<<"4. Exit"<<endl;
    cin>>menu;
    system("cls");
switch (menu){
case 1:
cout<<"Enter Value to Push : ";
cin>>p->value;
p->next = NULL;
system("cls");
head = p;
cout<<"Do you want to push another value?"<<endl;
cout<<"1. Yes"<<endl;
cout<<"2. No"<<endl;

cin>>sel;
system("cls");
    while (sel!=2){
    struct Node *q = new Node;
      cout<<"\nEnter Value to Push : ";    
cin>>q->value;
q->next=NULL;
p->next = q;
    p = p->next;
    system("cls");
        cout<<"Do you want to push another value?"<<endl;
        cout<<"1. Yes"<<endl;
        cout<<"2. No"<<endl;
        cin>>sel;
        system("cls");

    }
    goto ask;

break;
case 2:
p = head;
if (p->next==NULL && p->value == 0){
cout<<"\nStack is Empty\n\n";
}
while (p->next!=NULL){
r = p;
p = p->next;
}
r->next = NULL;
p->value = 0;

goto ask;

break;
case 3:
system("cls");
p= head;

cout<<"Stack contains the following values "<<endl;

while (p->next!=NULL){
if (p->value==0)
{
cout<<" ";
}
else
{
cout<<" "<<p->value;
}

p=p->next;

}
cout<<" "<<p->value;
cout<<"\n";
goto ask;

break;

case 4:
return 0;
break;
}


}

Tips to generate a reasonable revenue from your website

We are living in the age of technology. Now a days we face technology everywhere. To earn money through internet is not a new thing. The people have been earning money on internet in different ways. The most easiest way that people think is earn money through website or mobile app by monetizing their app or website with ads by google or any other network.

Earning money is not much easy as some people think. It demands a lot of time and hard work with determination and devotion.

There is a question which arrives in mind whenever we talk about to earn through a website. Which type of websites can generate revenue? What are the companies who pay for displaying their ads?

First of all I would like to elaborate the key points which should be kept in mind while development of a website. Every website is not able to generate revenue. To generate revenue from website is a fun if your website has a large range of daily visitors. But if you have very small number of visitors, it can be a fatigue for you or just a source of disappointment.

The following points are essential while development of a website. If these points are followed, you are almost near to generate revenue through a website.

  • First phase in development of website is idea for a website. You should have a mind blowing idea for making a website.
  • Your website should be unique.
  • An idea can change your life.
  • While searching an idea it should kept in mind that your idea is feasible.
  • Hire a great programmer to build your website or make a blog using different CMS like blogger.com, wordpress.com, webs.com etc.
  • Your website template should be eye catching and attractive.
  • Website design should be unique.
  • Website design should be modern but simple.
  • Simple is faster and complicated is slower.
  • So choose a simple and user friendly design.
  • A user should be able to use it easily.
  • Your website should have interesting material on it.
  • Material can be related to any category but it should be completely your own work.
  • It should be informative and helpful for others.
  • Visitors should love to spend time on your website.
  • After getting a well developed and designed website,  buy a good domain name and fast hosting service.
  • Optimize your website for search engines (SEO)
  • SEO is the only way to gain a lot of visitors daily
  • The stronger the SEO of your website, the more will be the number of visitors visiting your website.
  • Place ads on your website.
  • Keep posting and updating your website or provide any services to your visitors.
  • Avoid any type of copyright infringement.
In this way you will be owner of a well designed and well developed website and you will be able to generate revenue from it.

Friday, December 25, 2015

Parallel Computing

Parallel computing is collection of processing elements that communicate and co-operate to solve large problems fast. It is the use of two or more processors (cores, computers) in combination to solve a single problem.

Examples of Parallel System:
An example of parallel computing would be two servers that share the workload of routing mail, managing connections to an accounting system or database, solving a mathematical problem etc. Supercomputers are usually placed in parallel system architecture, Terminals connected to single server.

Advantages of Parallel System:
They provide concurrency, help in taking advantage of non-local resources, It is cost saving.
It is overcoming memory constraints. It saves time and money. It has global address space which provides a user-friendly programming perspective to memory.

Disadvantages of Parallel System:
Primary disadvantage is the lack of scalability between memory and CPUs.
Programmer responsibility for synchronization constructs that ensure "correct" access of global memory.
It becomes increasingly difficult and expensive to design and produce shared memory machines with ever increasing numbers of processors.

Types of Parallel Computing:
·         Data-parallel: Same operations on different data. It is also called SIMD.
·         SPMD: Same program, different data.
MIMD: Different programs, different data

_________________________________________________________________________________
Arslan ud Din Shafiq
COMSATS Institute of Information Technology
CS Department

Distributed Computing

A distributed system is a software system in which components located on networked computers communicate and coordinate their actions by passing messages. The components interact with each other in order to achieve a common goal.

Examples of Distributed System:  
World Wide Web, Sharing Clusters, Network of workstations, Network of branch office computers, Network of embedded systems, New Cell processor (PlayStation 3) etc are examples of distributed system.

Advantages of Distributed System:
Distributed Systems are information sharing, resource sharing, extensible, shorter response time and higher output, higher reliability, better flexibility’s in meeting user’s needs, better price/performance ratio, scalability, transparency.

Disadvantages of Distributed System:
Distributed systems have difficulties of developing distributed software, networking problem, security problems, performance is less, openness, less reliability and less fault tolerance. 

Types of Distributed Computing:
·         Host-Based Hierarchy
·         Decentralized Stand-Alone System
·         Peer-to-Peer LAN-based System
·         Hybrid Enterprise-wide System
·         Client-Server System
·         Internet-centric Computing Systems

Goals of Distributed System:
In distributed system, we work to achieve the following goals:
·        Transparency
·        Openness
·        Reliability
·        Performance
·        Scalability

_________________________________________________________________________________

Arslan ud Din Shafiq
COMSATS Institute of Information Technology
CS Department

Friday, April 17, 2015

Queues Implementation using Single Link List

Queues Implementation using Single Link List

#include <iostream>
using namespace std;
struct Node {
int value;
Node *next;
};
int main(){
int menu;
int sel;
int count=0;
struct Node *p = new Node;
struct Node *head = new Node;

for( int i=0;i<=79;i++){
cout<<'*';
}
cout<<"                     Built & Designed by Arslan Malik Aareez"<<endl;
cout<<"                          www.CWorldbyAS.blogspot.com"<<endl;
cout<<"                     Facebook : www.facebook.com/arslan.ud.din"<<endl;
cout<<"                     Twitter  : www.twitter.com/itsaareez"<<endl;
for( int i=0;i<=79;i++){
cout<<'*';
}

    ask:
    
cout<<"1. Insert\n2. Delete\n3. Print\n4. Exit"<<endl;
    cin>>menu;
    switch(menu){
     case 1:
     count++;
     cout<<"Enter Value to insert : ";
     cin>>p->value;
     p->next = NULL;
     head = p;
     system("cls");
     cout<<"Do you want to enter any other value?\n\n1. Yes\n2. No";
     cin>>sel;
            system("cls");
     while (sel!=2){
  struct Node *q = new Node;
count++;
     cout<<"Enter Value to insert : ";
     cin>>q->value;
         q->next = NULL;
     p->next = q;
     p = p->next;
     system("cls");
     cout<<"Do you want to enter any other value?\n\n1. Yes\n2. No";
     cin>>sel;
     system("cls");
     }
     goto ask;
     break;
     case 2:
     count--;
     p = head;
     head = p->next;
     p->value = 0;
     p->next = NULL;
     system("cls");
     goto ask;
     break;
    
     case 3:
     system("cls");
     p = head;
     if (count==0){
         system("cls");

cout<<"Queue is empty.";
     }
     else{
cout<<"Your queue has the following values"<<endl;
    
     while (p->next!=NULL){
     cout<<" "<<p->value;
     p = p->next;
     }
     cout<<" "<<p->value;
     }
     cout<<"\n\n";
system("pause");
      system("cls");
goto ask;
break;
    
     case 4:
     return 0;
     break;
    }


}

Stack Implementation using Single Link List

Stack Implementation using Single Link List

#include <iostream>
using namespace std;
struct Node{
int value;
Node *next;

};

int main(){

for( int i=0;i<=79;i++){
cout<<'*';
}
cout<<"                     Built & Designed by Arslan Malik Aareez"<<endl;
cout<<"                          www.CWorldbyAS.blogspot.com"<<endl;
cout<<"                     Facebook : www.facebook.com/arslan.ud.din"<<endl;
cout<<"                     Twitter  : www.twitter.com/itsaareez"<<endl;
for( int i=0;i<=79;i++){
cout<<'*';
}

int menu;
int sel;

struct Node *p = new Node;
struct Node *head = new Node;
struct Node *r = new Node;
head->next = NULL;
head->value=0;
    ask:
cout<<"Enter Your Choice\n"<<endl;
    cout<<"1. Push"<<endl;
    cout<<"2. Pop"<<endl;
    cout<<"3. Print"<<endl;
    cout<<"4. Exit"<<endl;
    cin>>menu;
    system("cls");
switch (menu){
case 1:
cout<<"Enter Value to Push : ";
cin>>p->value;
p->next = NULL;
system("cls");
head = p;
cout<<"Do you want to push another value?"<<endl;
cout<<"1. Yes"<<endl;
cout<<"2. No"<<endl;

cin>>sel;
system("cls");
    while (sel!=2){
     struct Node *q = new Node;
      cout<<"\nEnter Value to Push : ";    
cin>>q->value;
q->next=NULL;
p->next = q;
     p = p->next;
     system("cls");
        cout<<"Do you want to push another value?"<<endl;
        cout<<"1. Yes"<<endl;
        cout<<"2. No"<<endl;
        cin>>sel;
        system("cls");

    }
    goto ask;

break;
case 2:
p = head;
if (p->next==NULL && p->value == 0){
cout<<"\nStack is Empty\n\n";
}
while (p->next!=NULL){
r = p;
p = p->next;
}
r->next = NULL;
p->value = 0;

goto ask;

break;
case 3:
system("cls");
p= head;

cout<<"Stack contains the following values "<<endl;

while (p->next!=NULL){
if (p->value==0)
{
cout<<" ";
}
else
{
cout<<" "<<p->value;
}

p=p->next;

}
cout<<" "<<p->value;
cout<<"\n";
goto ask;

break;

case 4:
return 0;
break;
}


}

Friday, June 20, 2014

Get Abbreviation

Get abbreviation of a given name entered by user in C Programming language by Project Free TV . 

#include<stdio.h>
void header()
{
    printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
    printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t  Lahore , Pakistan\n\n\n");
}
int main()
{
    char name[100];
    int i=0;
    header();
    system("pause");
    system("cls");
    printf("Enter Name : ");
    gets(name);
    system("cls");
    printf("You have entered %s ",name);
    printf("\n\n\n\t\tAbbreviation");
    printf("\n\n\t\t     %c",name[i]);
    for(i=0;name[i]!='\0';i++)
    {
        if (name[i]==' ')
        {
            i++;
            printf("%c",name[i]);

        }
    }
printf("\n\n\n\n");
}

Strings Swapping using pointers , malloc() & strcpy()

We know that to swap two numbers in c programming language is much easy but can we swap two strings? Of course you can perform swapping on strings as well. The following program swap two strings using pointers, malloc() and strcpy().

#include<stdio.h>
#include<string.h>
#include<malloc.h>
void header()
{
    printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
    printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t  Lahore , Pakistan\n\n\n");
}
int main()
{
    char s1[100],s2[100];
    char *hold;
    header();
    system("pause");
    system("cls");
while (!feof(stdin))
{
    printf("Enter String 1 : ");
    gets(s1);
    printf("\nEnter String 2 : ");
    gets(s2);
    hold=malloc(0); //is used to provide memory for pointer *hold
    strcpy(hold,s1);
    strcpy(s1,s2);
    strcpy(s2,hold);
    printf("\n\n After Swapping \n\n ");
    printf(" String 1 : %s  ; String 2 : %s \n\n\n\n",s1,s2);
}
}

Functions to calculate string length using arrays

There are many programs in which we need to calculate the length of a string. To calculate string length we can use built in function in C Programming to calculate length but we should know what is going on in back end of this function or what is the structure of this function? The following code defines the structure of function used to calculate the length of a string.

#include<stdio.h>
int strln(char a[])
{
   int i;
   for(i=0;a[i]!='\0';i++);
   return i;

}
int main()
{
   int a[100000];
   puts("Enter String : ");
   gets(a);
   system("pause");
   system("cls");
   printf("\n\n\nString Length is %d \n\n\n\n\n",strln(a));
}

Function to copy one string into another using pointers

To copy one string to another string, we have built-in function defined in <string.h> library but to be a good programmer, we should have knowledge about the algorithm of function and the story of back end code. The following code is the implementation of function to copy one string into another using pointers in C Programming Language.


#include<stdio.h>
void strcp(char *a , char *b)
{
    int i;
    for(i=0;*b!='\0';i++)
    {
        *a=*b;
         a++;
         b++;

    }
}
void header()
{
    printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
    printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t  Lahore , Pakistan\n\n\n");
}
int main()
{
    char a[100];
    char b[100];
    header();
    system("pause");
    system("cls");
    puts("Enter String 1: ");
    gets(a);
    puts("Enter String 2 : ");
    gets(b);
    strcp(a,b);
    printf("\nAfter Copying String 2 in String 1 \n\n");
    printf("String 1 is : %s \n\n\n\n\n",a);
}

String Comparison using pointers , functions , loops and if selection statements

You can comparison two strings in C Programming language by using built-in function defined in <String.h>. The back end code working behind the function in <String.h> library to comparison two strings works as follows:

#include<stdio.h>
int stcp(char *a , char *b)
{
    int i;
    while(*a==*b)
    {
        if (*a=='\0' || *b=='\0')
        break;
        a++;
        b++;

    }
    if (*a=='\0' && *b=='\0')
        return 0;
    else return -1;
}
int main()
{
    char a[20],b[20];
    printf("Enter String 1 : ");
    scanf("%s",a);
    printf("Enter String 2 : ");
    scanf("%s",b);
    if(stcp(a,b)==0)
    {
        printf("String 1 = String 2");
    }
    else if (stcp(a,b)==-1)
    {
        printf("String 1 is not matching string 2");
    }
}

String Addition using pointers, functions and loop


String concatenation is a way to add two strings. For example if we have two strings "My" and "Name" then to produce these two strings as one string that is "My Name", we will concatenate these two strings. We can do concatenation in C Programming Language by using built-in string concatenation function defined in <String.h> library but we can also make our own function to concatenate two strings. The following code do concatenation of two strings using pointers, functions and loops.

#include <stdio.h>
#include<conio.h>

void concatenate_string(char*, char*);

int main()
{
    char original[100], add[100];

    printf("Enter source string\n");
    gets(original);

    printf("Enter string to concatenate\n");
    gets(add);

    concatenate_string(original, add);

    printf("String after concatenation is \"%s\"\n", original);
 getch();
    return 0;
}

void concatenate_string(char *original, char *add)
{
   while(*original)
      original++;

   while(*add)
   {
      *original = *add;
      add++;
      original++;
   }
   *original = '\0';
}

printing spaced letters in a string like ABC to A B C

#include<stdio.h>
#include<conio.h>
void header()
{
    printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
    printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t  Lahore , Pakistan\n\n\n");
}
int main()
{
    char a[30]={0};
    int i;
    header();
    system("pause");
    system("cls");
    printf("Enter String : ");
    scanf("%s",a);
    printf("\n");
    for(i=0;a[i]!='\0';i++)
    {
        printf(" %c ",a[i]);
    }
    printf("\n\n\n\n");
    getch();

}

Distinguish between vowels and consonants in strings

#include<stdio.h>
void header()
{
    printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
    printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t  Lahore , Pakistan\n\n\n");
}
int main()
{
    char name[100]={0};
    printf("Enter String : ");
    scanf("%[^aeiou]",name);
    printf("\n%s",name);
}

Search vowels in a string

#include<stdio.h>
void header()
{
    printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
    printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t  Lahore , Pakistan\n\n\n");
}
int main()
{
    char name[100]={0};
    header();
    system("pause");
    system("cls");
    printf("Enter String : ");
    scanf("%[aeiou]",name);
    printf("\n%s",name);
}

Reversing String

#include<stdio.h>
void header()
{
    printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
    printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t  Lahore , Pakistan\n\n\n");
}
int main()
{
    char name[30];
    int i,j;
    header();
    system("pause");
    system("cls");
    printf("Enter String : ");
    gets(name);
    printf("You have Entered : ");
    for(i=0;name[i]!='\0';i++)
    printf("%c",name[i]);
    printf("\n\n\n");
    for(i=0;name[i]!='\0';i++);
    printf("String Length : %d ",i);
    printf("\n\n\n");
    printf("Reversed String is : ");
    for(j=i;j>=0;j--)
    printf("%c",name[j]);
    printf("\n\n\n");
}

gets() and puts() function in String

#include<stdio.h>
int main()
{
    char c1[100];
    puts("Enter String : ");
    gets(c1);
    printf("You Have Entered : %s",c1);

}

Get String and Print string

#include<stdio.h>
int main()
{
  char c1[100],c2[100],c3[100],c4[100];
  puts("Enter Name of 1st City : ");
  gets(c1);
  puts("Enter Name of 2nd City : ");
  gets(c2);
  puts("Enter Name of 3rd City : ");
  gets(c3);
  puts("Enter Name of 4th City : ");
  gets(c4);
  printf("\n\n\n\n\n");
  puts(c1);
  puts(c2);
  puts(c3);
  puts(c4);

}