Skip to main content

Posts

Showing posts from 2021

Arrays in C++

Arrays in C++ C++ data types fall into different categories. One of these categories is the structured data type. This chapter and the next few chapters focus on structured data types. Recall that a data type is called simple if variables of that type can store only one value at a time. Ex: char, short, int, long, float and bool In contrast, in a structured data type, each data item is a collection of other data items. Ex: array, struct, union, class. Simple data types are building blocks of structured data types. Pointer data type used to store memory address of computer. let us consider the following problem. We want to write a C++ program that reads five numbers, finds their sum, average, and prints the numbers in reverse order. int num1, num2, num3, num4, num5; int sum=0, ave=0; cout<<"Enter number1";          cin>>num1;      cout<<"Enter number2";          cin>>num2; cout<<"Enter number3";          cin>>num3; cou