Showing posts with label cpp. Show all posts
Showing posts with label cpp. Show all posts

Monday, May 24, 2021

get current date of system in c++ cpp

 #include<iostream>

#include<ctime>
using namespace std;
int main()
{
    time_t now=time(0);
    cout<<"now is :"<<now<<endl;
    char* date_time=ctime (&now);
    cout<<date_time;
    
    return 0;
}


get student data and display on the screen by using oop



#include<iostream>
#include<string>
using namespace std;
class student
{
private:
    string fname;
    string name;
    int s1,s2,s3;
    int avg,sum;
public:
     void getData()
     {
         cout<<"Enter name of student:";getline(cin,name);
         cout<<"Enter marks of subject 1:";cin>>s1;
         cout<<"Enter marks of subject 2:";cin>>s2;
         cout<<"Enter marks of subject 3:";cin>>s3;
         sum=s1+s2+s3;
         avg=sum/3;
     }
     void showData()
     {
         cout<<"*********Result of students************"<<endl;
         cout<<"Name of student :"<<name<<endl;
         cout<<"Subject 1 Marks :"<<s1<<endl;
         cout<<"Subject 2 Marks :"<<s2<<endl;
         cout<<"Subject 3 Marks :"<<s3<<endl;
         cout<<"Total Obtained Marks :"<<sum<<endl;
         cout<<"Averages Marks of student :"<<avg<<endl;

     }
};

 

int main()
{
    student std1;
    std1.getData();
    std1.showData();
    
    return 0;

} 

Tuesday, February 2, 2021

online Shopping project for university full source code.

 https://www.eaglesoft.com.pk/online-shopping-project-for-university-in-c-developed-by-eaglesoft/

Thursday, January 21, 2021

Eaglesoft Banking System Software in c++ with Eaglesoft Programmers.

 


#include <iostream>
#include <string>
using namespace std;
struct ac
{
    int ac_number;
    string ac_name;
    float de;
    float withdraw;
};

int main()
{
    ac acounts[10];

    //    assin account number
    acounts[0].ac_number = 1;
    acounts[1].ac_number = 2;
    acounts[2].ac_number = 3;
    acounts[3].ac_number = 4;
    acounts[4].ac_number = 5;
    acounts[5].ac_number = 6;
    acounts[6].ac_number = 7;
    acounts[7].ac_number = 8;
    acounts[8].ac_number = 9;
    acounts[9].ac_number = 10;
    // assign name of accounts
    acounts[0].ac_name = "Ashfaq";
    acounts[1].ac_name = "Saif";
    acounts[2].ac_name = "Ansir";
    acounts[3].ac_name = "Zoha";
    acounts[4].ac_name = "Abraz";
    acounts[5].ac_name = "Aysha";
    acounts[6].ac_name = "Manal";
    acounts[7].ac_name = "Muzammal";
    acounts[8].ac_name = "Aamir";
    acounts[9].ac_name = "Naveed";

    // assign balance of accounts
    acounts[0].de = 0;
    acounts[1].de = 0;
    acounts[2].de = 0;
    acounts[3].de = 0;
    acounts[4].de = 0;
    acounts[5].de = 0;
    acounts[6].de = 0;
    acounts[7].de = 0;
    acounts[8].de = 0;
    acounts[9].de = 0;

    int ac;
    while (5)
    {
        cout << "Enter acount number:" << endl;
        cin >> ac;
        cin.ignore();
        for (int i = 0; i < 10; i++)
        {
            if (ac == acounts[i].ac_number)
            {
                float _input_de, _input_wi;
                cout << "Enter your Depsit Money:" << endl;
                cin >> _input_de;
                cout << "Enter Money that you want to Withdraw:" << endl;
                cin >> _input_wi;
                cin.ignore();
                cout << "Thank you for using Eaglesoft Banking System:" << endl;
                acounts[i].de = acounts[i].de + _input_de;
                acounts[i].de = acounts[i].de - _input_wi;
                cout << "*****Your Account Details*****" << endl;
                cout << "Account Number: " << acounts[i].ac_number << endl;
                cout << "Account Name: " << acounts[i].ac_name << endl;
                cout << "Your current balance is :" << acounts[i].de << endl;
            }
        }
    }

    return 0;
}

Sunday, January 17, 2021

Structure in c++ with Eaglesoft.

 


#include<iostream>
using namespace std;
struct eaglesoft  
{
    char name[50];
    char role[50];
    int salary;
};
int main()
{
     eaglesoft e1[2000];

     for(int i=0;i<2000;i++)
     {
         cout<<"Enter recor #"<<i+1<<" :"<<endl;
         cout<<"Enter the name of Eaglesoft Eagle: "<<endl;
         cin>>e1[i].name;
         cout<<"Enter the role of Eaglesoft Eagle: "<<endl;
         cin>>e1[i].role;
         cout<<"Enter the salary of Eaglesoft Eagle: "<<endl;
         cin>>e1[i].salary;
    
     } 
     int ch;
    cout<<"Press 1 for get data of "<<e1[0].name<<" "<<endl;
    cout<<"Press 2 for get data of "<<e1[1].name<<" "<<endl;
    cout<<"Press 3 for get data of "<<e1[2].name<<" "<<endl;
    cout<<"Press 4 for get data of "<<e1[3].name<<" "<<endl;
    cin>>ch;
    if(ch==1)
    {
        cout<<"***********Details of "<<e1[0].name<<"*********** "<<endl;
        cout<<"Name:"<<e1[0].name<<endl;
        cout<<"Role:"<<e1[0].role<<endl;
        cout<<"Salary:"<<e1[0].salary<<endl;
    }
    else if(ch==2)
        {
        cout<<"***********Details of "<<e1[1].name<<"*********** "<<endl;
        cout<<"Name:"<<e1[1].name<<endl;
        cout<<"Role:"<<e1[1].role<<endl;
        cout<<"Salary:"<<e1[1].salary<<endl;
    }
    else if(ch==3)
        {
        cout<<"***********Details of "<<e1[2].name<<"*********** "<<endl;
        cout<<"Name:"<<e1[2].name<<endl;
        cout<<"Role:"<<e1[2].role<<endl;
        cout<<"Salary:"<<e1[2].salary<<endl;
    }
    else if(ch==4)
        {
        cout<<"***********Details of "<<e1[3].name<<"*********** "<<endl;
        cout<<"Name:"<<e1[3].name<<endl;
        cout<<"Role:"<<e1[3].role<<endl;
        cout<<"Salary:"<<e1[3].salary<<endl;
    }
    else  
    {
        cout<<"invalid input! There is no such Eagle in Eaglesoft"<<endl;
    }
 
    return 0;
}

Wednesday, January 13, 2021

New and delelte operator in c++

 


#include <iostream>
using namespace std;
int main()
{
    int *p1, *p2, sum;
    p1 = new int;
    p2 = new int;
    cout << "Enter first value: " << endl;
    cin >> *p1;
    cout << "Enter secend value: " << endl;
    cin >> *p2;
    sum = *p1 + *p2;
    cout << "Sum of first and second value is :" << sum << endl;
    delete p1;
    delete p2;

    return 0;
}

Monday, January 11, 2021

Transpose of a matrix in two dimensional array c++

 


#include<iostream>
using namespace std;
int main()
{
    int n[3][3];
    // Take input from user
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cout<<"Enter value of n["<<i<<"]"<<"["<<j<<"]"<<endl;
            cin>>n[i][j];
        }
    }
    // Show Matrix
    cout<<"Matriz is..."<<endl;
        for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cout<<n[i][j]<<"  ";
        }
        cout<<endl;
    }
    // Transpose is
    cout<<"Transpose is..."<<endl;
        for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cout<<n[j][i]<<"  ";
        }
        cout<<endl;
    }
    
    return 0;
}

Saturday, January 9, 2021

Bubble short in c++ with Eaglesoft programmer

 


#include<iostream>
using namespace std;
int main()
{
    int a[5]={3,2,5,7,8},tem;
    // show value of array before sorting 
    for(int i=0;i<5;i++)
    {
        cout<<"Value of array:"<<a[i]<<endl;
    }
    for(int i=0;i<5;i++)
    {
        for(int j=0;j<4-i;j++)
        {
            if(a[j]>a[j+1])
            {
                tem=a[j+1];
                a[j+1]=a[j];
                a[j]=tem;
            }
        }
    }

    // Show output of sorting array 
    for(int i=0;i<5;i++)
    {
        cout<<"Value of array :"<<a[i]<<endl;
    }
    return 0;
}

Wednesday, January 6, 2021

Delete Element from array in c++ with Eaglesoft programmers

 


#include <iostream>
using namespace std;
int main()
{
    int array[5] = {4, 3, 2, 5, 6};
    int p;
    cout << "Before delete element" << endl;
    for (int i = 0; i < 5; i++)
    {
        cout << "Value of array[" << i << "] " << array[i] << endl;
    }
    cout << "Enter position of element that you want to delete:" << endl;
    cin >> p;
    for (int i = p; i < 5; i++)
    {
        array[i] = array[i + 1];
    }
    cout << "After delete element" << endl;
    for (int i = 0; i < 4; i++)
    {
        cout << "Value of array[" << i << "] " << array[i] << endl;
    }
    return 0;
}

Insertion in array in c++ with Eaglesoft Programmers

 


#include<iostream>
using namespace std;
int main()
{
    int array[100]={4,5,6,7,32};
    int pos,num;
    // take value and position
    cout<<"Enter the value that you want to insert in array:"<<endl;
    cin>>num;
    cout<<"Enter the position of array where you want to insert you entred vlue: "<<endl;
    cin>>pos;

    // insert value in array
    for(int i=4;i>=pos;i--)
    {
        array[i+1]=array[i];
    }
    array[pos]=num;

    // show array value after inserting
    cout<<"new array is : "<<endl;
    for (int i=0;i<6;i++)
    {
        cout<<"Value of array["<<i<<"]: "<<array[i]<<endl;
    }


    return 0;
}

Saturday, December 26, 2020

Insert new value in array at specific location in c++ with Eaglesoft programmers.

 


#include<iostream>
using namespace std;
int main()
{
    int array[100]={4,5,6,7,32};
    int pos,num;
    // take value and position
    cout<<"Enter the value that you want to insert in array:"<<endl;
    cin>>num;
    cout<<"Enter the position of array where you want to insert you entred vlue: "<<endl;
    cin>>pos;

    // insert value in array
    for(int i=4;i>=pos;i--)
    {
        array[i+1]=array[i];
    }
    array[pos]=num;

    // show array value after inserting
    cout<<"new array is : "<<endl;
    for (int i=0;i<6;i++)
    {
        cout<<"Value of array["<<i<<"]: "<<array[i]<<endl;
    }


    return 0;
}

Search input Data from array by using binary method with Eaglesoft programmers.

 


#include <iostream>
using namespace std;
int main()
{
    int num[10] = {3, 4, 5, 6, 7, 22, 34, 44, 57, 76};
    int s = 0, l = 10, mid, loc = 0;
    int _input;

    // run infinty time of program
    while (true)
    {
        // take input form user
        cout << "Enter a value that you want to find in array: " << endl;
        cin >> _input;

        // search data from array
        while (s <= l)
        {
            mid = (s + l) / 2;
            if (_input == num[mid])
            {
                // cout<<"Found at position: "<<mid<<endl;
                loc = mid;
                break;
            }
            else if (_input > num[mid])
            {
                s = ++mid;
            }
            else
            {
                l = --mid;
            }
        }

        // print data on screen getting from array
        if (num[loc] == _input)
        {
            cout << "Found at position: " << loc << endl;
        }
        else
        {
            cout << "Value not found in array!" << endl;
        }
        cout << "******************************************" << endl;
    }

    return 0;
}

Thursday, December 24, 2020

Arrays in cpp with Eaglesoft

 


#include<iostream>
using namespace std;
int main()
{
    int num[4000],limit;
    cout<<"Enter size of array less than 4000:"<<endl;
    cin>>limit;
    if(limit>4000)
    {
        cout<<"Please Enter size of array less than 4000"<<endl;
    }
    else
    {
        for(int i=0;i<limit;i++)
        {
            cout<<"Enter you "<<i+1<<" Value :"<<endl;
            cin>>num[i];
        }
        for(int i=0;i<limit;i++)
        {
            cout<<"Enter value of "<<i+1<<" :"<<num[i]<<endl;
        }
    }

    cout<<"***Eaglesoft Programmers***"<<endl;
    return 0;
}

Wednesday, December 23, 2020

Arrays and Pointers in c++ | cpp with Eaglesoft

 


#include<iostream>
using namespace std;
int main()
{
    int num[100],limit;
    cout<<"Enter array limit: "<<endl;
    cin>>limit;
    int *p;
    p=num;
    for (int i = 0; i < limit; i++)
    {
        cout<<"Enter value of of a["<<i<<"] :"<<endl;
        cin>>num[i];
    }
    for (int i = 0; i < limit; i++)
    {
        cout<<"Value of a["<<i<<"] :"<<*p++<<endl;
    }
    
    cout<<"******Eaglesoft Porgrammers******"<<endl;
    return 0;
}