Sunday 1 February 2015

Array Numbers Initialization in C++

Structure of the Problem Requirements 

Array is a set of values in which we can store multiple values and access them one by one. When we initialize array it contain the garbage values and here in this problem we will remove these garbage values and initialize these values with zero.

Source Code

#include<iostream>
using namespace std;
int main ()
{
int nums[5];
cout<<"\t \t \t LEP Tutorials \n \n \n ";
cout<<"1. Numbers Without Initialization \n ";
for (int i =0;i<5;i++)
{
cout<<endl;
cout<<"\t"<<nums[i];
}
cout<<endl<<endl;
cout<<"2. Numbers After Initialization \n ";
for (int i =0;i<5;i++)
{
nums[i] = 0;
cout<<endl;
cout<<"\t"<<nums[i];
}
}

Output of the Program

Array Numbers Initialization in C++

Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment