diff --git a/C++/Array/ArrayDemo1.cpp b/C++/Array/ArrayDemo1.cpp new file mode 100644 index 0000000..af102d2 --- /dev/null +++ b/C++/Array/ArrayDemo1.cpp @@ -0,0 +1,40 @@ + + +#include +using namespace std; + +int main() +{ + // interger array of five elements + int marks[5]; + + // assigning values + cout << "Please enter the marks of student 1 : " ; + cin >> marks[0] ; + + cout << "Please enter the marks of student 2 : " ; + cin >> marks[1] ; + + cout << "Please enter the marks of student 3 : " ; + cin >> marks[2] ; + + cout << "Please enter the marks of student 4 : " ; + cin >> marks[3] ; + + cout << "Please enter the marks of student 5 : " ; + cin >> marks[4] ; + + + // accessing array values + cout << "marks[0] :" << marks[0] << endl; + cout << "marks[1] :" << marks[1] << endl; + cout << "marks[2] :" << marks[2] << endl; + cout << "marks[3] :" << marks[3] << endl; + cout << "marks[4] :" << marks[4] << endl; + + + + cout << "size of marks array : " << sizeof(marks) << endl; + + return 0; +} diff --git a/C++/Array/ArrayDemo2.cpp b/C++/Array/ArrayDemo2.cpp new file mode 100644 index 0000000..12d5ad1 --- /dev/null +++ b/C++/Array/ArrayDemo2.cpp @@ -0,0 +1,30 @@ + + +#include +using namespace std; + +int main() +{ + + int size; + cout << "Please enter the strenght of students in your class : "; + cin >> size; + + // interger array of user defined size + int marks[size]; + + // assigning values + for(int i=0; i> marks[i]; + } + + // accessing array values + for(int i=0; i +using namespace std; + +int main() +{ + // interger array of five elements + int marks[5]; + + // assigning values + marks[0] = 85; + marks[1] = 85; + marks[2] = 85; + marks[3] = 85; + marks[4] = 85; + marks[5] = 85; // the indexes out of initialization-size + marks[6] = 85; + + marks[10] = 85; + + + // accessing array values + cout << "marks[0] :" << marks[0] << endl; + cout << "marks[1] :" << marks[1] << endl; + cout << "marks[2] :" << marks[2] << endl; + cout << "marks[3] :" << marks[3] << endl; + cout << "marks[4] :" << marks[4] << endl; + cout << "marks[5] :" << marks[5] << endl; + cout << "marks[6] :" << marks[6] << endl; + cout << "marks[7] :" << marks[7] << endl; + cout << "marks[8] :" << marks[8] << endl; + cout << "marks[9] :" << marks[9] << endl; + cout << "marks[10] :" << marks[10] << endl; + + + + cout << "size of marks array : " << sizeof(marks) << endl; + + return 0; +} diff --git a/C++/Array/ArrayDemo_boundryCheck.cpp b/C++/Array/ArrayDemo_boundryCheck.cpp new file mode 100644 index 0000000..ee6da99 --- /dev/null +++ b/C++/Array/ArrayDemo_boundryCheck.cpp @@ -0,0 +1,26 @@ + + +#include +using namespace std; + +int main() +{ + // decalre + initialize + int marks[5] = {50, 60, 70, 80, 90 }; + + int index; + cout << "Please enter the roll number for which you want to see the marks " ; + cin >> index ; + + if (index >=1 && index < 6) // boundary check + { + cout << marks[index-1]; + } + else + { + cout << "Error: You entered wrong roll number... Please try again" << endl; + } + + + return 0; +} diff --git a/C++/Array/ArrayDemo_initialization.cpp b/C++/Array/ArrayDemo_initialization.cpp new file mode 100644 index 0000000..6a5fadd --- /dev/null +++ b/C++/Array/ArrayDemo_initialization.cpp @@ -0,0 +1,21 @@ + + +#include +using namespace std; + +int main() +{ + // decalre + initialize + int marks[5] = {50, 60, 70, 80, 90 }; + + + // accessing array values + for(int i=0; i<5; i++) + { + cout << "marks[" << i << "]: " << marks[i] << endl; + } + + + + return 0; +} diff --git a/C++/Array/Array_Associativity.cpp b/C++/Array/Array_Associativity.cpp new file mode 100644 index 0000000..14a3783 --- /dev/null +++ b/C++/Array/Array_Associativity.cpp @@ -0,0 +1,25 @@ + + +#include +using namespace std; + +int main() +{ + int marks[5]; + string name[5]; + + for (int i=0; i<5; i++) + { + cout << "Please enter the name of student : " ; + cin >> name[i]; + + cout << "Please enter the marks of " << name[i] << " : "; + cin >> marks[i]; + + } + + for(int i=0; i<5; i++) + cout << name[i] << "---" << marks[i] << endl; + + return 0; +} diff --git a/C++/Array/Array_Function.cpp b/C++/Array/Array_Function.cpp new file mode 100644 index 0000000..3fd68f7 --- /dev/null +++ b/C++/Array/Array_Function.cpp @@ -0,0 +1,51 @@ + + +#include +using namespace std; + +void printInfo(int[] , int); //prototype +void modify(int[] , int); //prototype + +int main() +{ + int size = 5; + int marks[size]; + string name[size]; + + for (int i=0; i> name[i]; + + cout << "Please enter the marks of " << name[i] << " : "; + cin >> marks[i]; + } + + printInfo(marks, size); // by ref + modify(marks, size); + + // displaying after modification + for(int i=0; i +using namespace std; + +int main() +{ + // interger array + int number[5] = {10, 20, 30, 40, 50}; + int data[5] = {10, 20, 30, 40, 60}; + + cout << "Address of number : " << number << endl; + cout << "Address of data : " << data << endl; + + // Match array references + if(number == data) + cout << "The arrays are equal. " << endl; + else + cout << "The arrays are not equal." << endl; + + // Matching array elements one by one. + bool flag = true; + int index; + for (int i=0; i<5; i++) + { + if(data[i] != number[i]) + { + flag = false; + index = i; + } + } + + if(flag) + cout << "The array elements are equal. " << endl; + else + { + cout << "The array elements are not equal." << endl; + cout << "Mismatched index is : " << index << endl; + } + + + + return 0; +} diff --git a/C++/Array/Array_processing.cpp b/C++/Array/Array_processing.cpp new file mode 100644 index 0000000..9717c5a --- /dev/null +++ b/C++/Array/Array_processing.cpp @@ -0,0 +1,24 @@ + + +#include +using namespace std; + +int main() +{ + // interger array of five elements + int number[5] = { 15, 25, 35, 45, 55 }; + + + int value = number[2]++; + cout << value << endl; // ??? 35? + + for(int var:number) + cout << var << endl; + + + int index = 2; + int value1 = number[index++]; + cout << value1 << endl; + + return 0; +} diff --git a/C++/Array/Array_processing1.cpp b/C++/Array/Array_processing1.cpp new file mode 100644 index 0000000..95f0d7e --- /dev/null +++ b/C++/Array/Array_processing1.cpp @@ -0,0 +1,28 @@ + + +#include +using namespace std; + +int main() +{ + // interger array of five elements + int number[5] = { 15, 25, 35, 45, 55 }; + + int sum = 0; + for(int var:number) + { + sum = sum + var; + } + cout << "Sum :" << sum << endl; + cout << "Avg :" << sum/5.0 << endl; + + int add=0; + for(int i=0; i<=4; i++) + { + add = add + number[i]; + } + cout << "Add :" << add << endl; + cout << "Avg :" << add/5.0 << endl; + + return 0; +} diff --git a/C++/Array/Array_processing2.cpp b/C++/Array/Array_processing2.cpp new file mode 100644 index 0000000..ddd8775 --- /dev/null +++ b/C++/Array/Array_processing2.cpp @@ -0,0 +1,30 @@ + + +#include +using namespace std; + +int main() +{ + // interger array + int number[10]; + int counter = 0; // maintain the counting of properly initialized elements + + //initialize + for(int i=0; i<5; i++) + { + cin >> number[i]; + counter++; + } + + + cout << "The value of counter : " << counter << endl; + + int sum=0; + for(int i=0; i +using namespace std; + +int main() +{ + // string array of six elements + string name[6] = { + "Marcin", + "Florian", + "Kristin", + "Zeyd", + "Kimiaki", + "Khan", + }; + + //for(dataType rangeVariable:Array-name) + for(string &var:name) // accessing by reference + { + var = "Hassan"; + } + + // accessing by value + for(string var:name) + { + cout << var << endl; + } + return 0; +} diff --git a/C++/Array/Array_twoD.cpp b/C++/Array/Array_twoD.cpp new file mode 100644 index 0000000..2ba3e9b --- /dev/null +++ b/C++/Array/Array_twoD.cpp @@ -0,0 +1,68 @@ + +#include +using namespace std; + +const int rows = 3; +const int cols = 4; + +void getData(int[][cols], int); +void showData(int[][cols], int); +int sum(int[][cols], int); + +int main() +{ + int marks[rows][cols]; + + getData(marks , rows); + showData(marks , rows); + int result = sum(marks , rows); + + return 0; +} + + + +void getData(int data[][cols] , int rows) +{ + // initilization using user input + for(int i=0; i> data[i][j]; + } + + } +} + + + +void showData(int data[][cols] , int rows) +{ + // Printing + for(int i=0; i +using namespace std; + +void showManue() +{ + cout<<"This is Misbah's Fast Food Restaurant"<>choice; + if(choice==1) + { + cout<<"HOW MANY BURGERS YOU WANT TO BUY?"<>quantity; + showPrice(burger_rate,quantity); + } + + if(choice==2) + { + cout<<"HOW MANY PIZZAS YOU WANT TO BUY?"<>quantity; + showPrice(pizza_rate,quantity); + } + + if(choice==3) + { + cout<<"HOW MANY SHAWARMAS YOU WANT TO BUY?"<>quantity; + showPrice(shawarma_rate,quantity); + } + + + } + + while(choice != 4); + cout<<"Thankyou for selecting Misbah's Food items!!!"< +//using namespace std; +//void qualify(); +//void noQualify(); +// void qualify(int sal) +// { +// if (sal>=2) +// { +// cout<<"Qualified"<> salary; +// cout << "How many years have you worked at your "; +// cout << "current job? "; +// cin >> years; +// if (salary >= 17000.0 && years >= 2) +// qualify(years); +// else +// noQualify(); +// +// +// return 0; +// } + +//#include +//using namespace std; +//void displayValue(int); +//int main() +//{ +// +// cout<<"I am passing 5 to displayValue"< +//using namespace std; +//void show(int, int,int); +//int main() +//{ +// int value1,value2,value3; +// cout<<"Enter the values for 1,2 and 3"<>value1>>value2>>value3; +// +// show(value1,value2,value3); +// return 0; +//} +// +//void show(int num1,int num2,int num3) +//{ +// cout<<(num1+num2+num3)< +//using namespace std; +//void num(int); +//int main() +//{ +// int value; +// cout<<"Input a value:"<>value; +// num(value); +// cout<<"Now the value is:"< +#include +using namespace std; +void showmenue(); +void showfees(double,int); +int main() +{ +int choice; +int months; +const int ADULT_CHOICE=1, + CHILD_CHOICE=2, + SENIOR_CHOICE=3, + QUIT_CHOICE=4; + +const double ADULT = 40.0, + CHILD = 20.0, + SENIOR = 30.0; + + cout<>choice; + while(choice < ADULT_CHOICE || choice > QUIT_CHOICE) + { + cout<<"Please enter a valid choice!!!"<>choice; + + } + while(choice != QUIT_CHOICE); + { + cout<<"For how many months?"<>months; + + + switch (choice) + { + case ADULT_CHOICE: + showfees(ADULT,months); + break; + + case CHILD_CHOICE: + showfees(CHILD,months); + break; + + case SENIOR_CHOICE: + showfees(SENIOR,months); + break; + + } + + } + } + diff --git a/C++/Array/Hello world .....cpp b/C++/Array/Hello world .....cpp new file mode 100644 index 0000000..5ac77c1 --- /dev/null +++ b/C++/Array/Hello world .....cpp @@ -0,0 +1,80 @@ +#include +#include +using namespace std; +void showmenue(); +void showfees(double,int); +int main() +{ +int choice; +int months; +const int ADULT_CHOICE=1, + CHILD_CHOICE=2, + SENIOR_CHOICE=3, + QUIT_CHOICE=4; + +const double ADULT = 40.0, + CHILD = 20.0, + SENIOR = 30.0; + + cout<>choice; + while (choice < ADULT_CHOICE || choice > QUIT_CHOICE) + { + cout<<"Please enter a valid choice!!!"<>choice; + + } + + if(choice != QUIT_CHOICE) + + { + cout<<"For how many months?"<>months; + + + switch (choice) + { + case ADULT_CHOICE: + showfees(ADULT,months); + break; + + case CHILD_CHOICE: + showfees(CHILD,months); + break; + + case SENIOR_CHOICE: + showfees(SENIOR,months); + + + } + + } + } + + while (choice != QUIT_CHOICE); + return 0; + + } + + void showmenue() + { + cout<<"Health club membership Menue"; + <<"1. Standard Adult Membership"; + <<"2.Child Membership "; + <<"3.Senior Citizen Membership"; + <<"4.Quit the programm"; + <<"Ėnter your choice:"< +#include +using namespace std; +void showmenue(); +void showfees(double,int); +int main() +{ +int choice; +int months; +const int ADULT_CHOICE=1, + CHILD_CHOICE=2, + SENIOR_CHOICE=3, + QUIT_CHOICE=4; + +const double ADULT = 40.0, + CHILD = 20.0, + SENIOR = 30.0; + + cout<>choice; + while (choice < ADULT_CHOICE || choice > QUIT_CHOICE) + { + cout<<"Please enter a valid choice!!!"<>choice; + + } + + if(choice != QUIT_CHOICE) + + { + cout<<"For how many months?"<>months; + + + switch (choice) + { + case ADULT_CHOICE: + showfees(ADULT,months); + break; + + case CHILD_CHOICE: + showfees(CHILD,months); + break; + + case SENIOR_CHOICE: + showfees(SENIOR,months); + + + } + + } + } + + while (choice != QUIT_CHOICE); + return 0; + + } + + void showmenue() + { + cout<<"Health club membership Menue"; + <<"1. Standard Adult Membership"; + <<"2.Child Membership "; + <<"3.Senior Citizen Membership"; + <<"4.Quit the programm"; + <<"Ėnter your choice:"< +using namespace std; + +void showManue() +{ + cout<<"This is Misbah's Fast Food Restaurant"<>choice; + if(choice==1) + { + cout<<"HOW MANY BURGERS YOU WANT TO BUY?"<>quantity; + showPrice(burger_rate,quantity); + } + + if(choice==2) + { + cout<<"HOW MANY PIZZAS YOU WANT TO BUY?"<>quantity; + showPrice(pizza_rate,quantity); + } + + if(choice==3) + { + cout<<"HOW MANY SHAWARMAS YOU WANT TO BUY?"<>quantity; + showPrice(shawarma_rate,quantity); + } + + + } + + while(choice != 4); + cout<<"Thankyou for selecting Misbah's Food items!!!"< +#include +using namespace std; +void showmenue(); +void showfees(double,int); +int main() +{ +int choice; +int months; +const int ADULT_CHOICE=1, + CHILD_CHOICE=2, + SENIOR_CHOICE=3, + QUIT_CHOICE=4; + +const double ADULT = 40.0, + CHILD = 20.0, + SENIOR = 30.0; + + cout<>choice; + while (choice < ADULT_CHOICE || choice > QUIT_CHOICE) + { + cout<<"Please enter a valid choice!!!"<>choice; + + } + + if(choice != QUIT_CHOICE) + + { + cout<<"For how many months?"<>months; + + + switch (choice) + { + case ADULT_CHOICE: + showfees(ADULT,months); + break; + + case CHILD_CHOICE: + showfees(CHILD,months); + break; + + case SENIOR_CHOICE: + showfees(SENIOR,months); + + + } + + } + } + + while (choice != QUIT_CHOICE); + return 0; + + } + + void showmenue() + { + cout<<"Health club membership Menue"; + <<"1. Standard Adult Membership"; + <<"2.Child Membership "; + <<"3.Senior Citizen Membership"; + <<"4.Quit the programm"; + <<"Ėnter your choice:"< +using namespace std; +int main() +{ + int values[5], count; +for (count = 0; count < 5; count++) + values[count] = count + 1; +for (count = 0; count < 5; count++) + cout << values[count] << endl; + + return 0; +} + diff --git a/C++/Array/array.exe b/C++/Array/array.exe new file mode 100644 index 0000000..0f254cd Binary files /dev/null and b/C++/Array/array.exe differ diff --git a/C++/Array/error.cpp b/C++/Array/error.cpp new file mode 100644 index 0000000..bdc36a7 --- /dev/null +++ b/C++/Array/error.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; +int main() +{ + int a=2; + int b=3; + if(b=a) + { + cout<<(a+1)<<" "<<(b-1)< +using namespace std; +void displayMessage(); +int main() +{ +cout<<"Main starting!!"< +//using namespace std; +//void showDouble(int); // Function prototype +//int main() +// { +// int num; +// for (num = 0; num < 10; num++) +// showDouble(num); +// return 0; +// } +//// Definition of function showDouble. +//void showDouble(int value) +// { +// cout << value << "\t" << (value * 2) << endl; +// } + + +// +//#include +//using namespace std; +//void func1(double, int); // Function prototype +//int main() +// { +// int x = 0; +// double y = 1.5; +// cout << x << " " << y << endl; +// func1(y, x); +// cout << x << " " << y << endl; +// return 0; +// } +// +// void func1(double a, int b) +// { +// cout << a << " " << b << endl; +// a = 0.0; +// b = 10; +// cout << a << " " << b << endl; +// } + diff --git a/C++/Array/programm.cpp b/C++/Array/programm.cpp new file mode 100644 index 0000000..5ac77c1 --- /dev/null +++ b/C++/Array/programm.cpp @@ -0,0 +1,80 @@ +#include +#include +using namespace std; +void showmenue(); +void showfees(double,int); +int main() +{ +int choice; +int months; +const int ADULT_CHOICE=1, + CHILD_CHOICE=2, + SENIOR_CHOICE=3, + QUIT_CHOICE=4; + +const double ADULT = 40.0, + CHILD = 20.0, + SENIOR = 30.0; + + cout<>choice; + while (choice < ADULT_CHOICE || choice > QUIT_CHOICE) + { + cout<<"Please enter a valid choice!!!"<>choice; + + } + + if(choice != QUIT_CHOICE) + + { + cout<<"For how many months?"<>months; + + + switch (choice) + { + case ADULT_CHOICE: + showfees(ADULT,months); + break; + + case CHILD_CHOICE: + showfees(CHILD,months); + break; + + case SENIOR_CHOICE: + showfees(SENIOR,months); + + + } + + } + } + + while (choice != QUIT_CHOICE); + return 0; + + } + + void showmenue() + { + cout<<"Health club membership Menue"; + <<"1. Standard Adult Membership"; + <<"2.Child Membership "; + <<"3.Senior Citizen Membership"; + <<"4.Quit the programm"; + <<"Ėnter your choice:"< +using namespace std; +int main() + +{ + const int LETTER=5; + char letter[LETTER]={'a','b','c','d','e'}; + for(int i=0; i(letter[i])<<" "; + } + + return 0; + +} + diff --git a/C++/File folder/ARRAY.exe b/C++/File folder/ARRAY.exe new file mode 100644 index 0000000..7a2db1a Binary files /dev/null and b/C++/File folder/ARRAY.exe differ diff --git a/C++/File folder/D.txt b/C++/File folder/D.txt new file mode 100644 index 0000000..6c86c77 --- /dev/null +++ b/C++/File folder/D.txt @@ -0,0 +1,2 @@ +C:\Users\Misbah_Aziz\Desktop\2nd semester\Programming fundamentals\File folder\b.cpp In function 'int main()': +6 13 C:\Users\Misbah_Aziz\Desktop\2nd semester\Programming fundamentals\File folder\b.cpp [Error] range-based 'for' loops are not allowed in C++98 mode diff --git a/C++/File folder/Data.txt b/C++/File folder/Data.txt new file mode 100644 index 0000000..2fb6bcb --- /dev/null +++ b/C++/File folder/Data.txt @@ -0,0 +1 @@ +12345678910 \ No newline at end of file diff --git a/C++/File folder/DemoFile.txt b/C++/File folder/DemoFile.txt new file mode 100644 index 0000000..07ab1e6 --- /dev/null +++ b/C++/File folder/DemoFile.txt @@ -0,0 +1,5 @@ +Studies +Misbah Aziz +Success +Aims +Focus diff --git a/C++/File folder/DemoFile1.txt b/C++/File folder/DemoFile1.txt new file mode 100644 index 0000000..a098095 --- /dev/null +++ b/C++/File folder/DemoFile1.txt @@ -0,0 +1 @@ +Misbah AzizTariq AzizDanish AzizTanveer Aziz \ No newline at end of file diff --git a/C++/File folder/DemoFile2.txt b/C++/File folder/DemoFile2.txt new file mode 100644 index 0000000..a098095 --- /dev/null +++ b/C++/File folder/DemoFile2.txt @@ -0,0 +1 @@ +Misbah AzizTariq AzizDanish AzizTanveer Aziz \ No newline at end of file diff --git a/C++/File folder/File 13.cpp b/C++/File folder/File 13.cpp new file mode 100644 index 0000000..6f87818 --- /dev/null +++ b/C++/File folder/File 13.cpp @@ -0,0 +1,22 @@ +//Programm to store 10 numbers in file +#include +#include +using namespace std; +int main() +{ + ofstream File; + File.open("Data.txt"); + + cout<<"Writuing the data to file"< +#include +using namespace std; +int main() +{ + ifstream input; + input.open("Numbers.txt"); + int num; + while(input>>num) + { + cout< +#include +using namespace std; +int main() +{ + ofstream File; + File.open("Data.txt"); + + cout<<"Writing the data to file"< +#include +using namespace std; +int main() +{ + ifstream F; + F.open("info.txt"); + int num; + + //check if input fiile exist or not +// if(F) +// { +// while(F>>num) +// { +// cout< +#include +using namespace std; +int main() +{ + ifstream F; + string filename; + int num; + //get the filename by the user + cout << "Enter the filename"; ` + cin>>filename; + F.open("filename"); + if (F) + { + while(F>>num) + { + cout< + #include + using namespace std; + int main() + { + ifstream F; + string filename; + int num; + + cout<<"Enter the file name"<>filename; + + F.open(filename.c_str()); + + if(F) + { + while(F>>num ) + { + cout< +#include +using namespace std; +int main() +{ + +// double value; +// char choice; +// cout<<"Enter a number"<>value; +// +// for(int i=0;i<=10;i++) +// { +// cout<>choice; +// if(choice=='Q' || choice=='q') +// break; +// } + + +double value; +char choice; +cout<<"Enter a number : "<>value; + +for(int i=0;i<10;i++) +{ + cout<>choice; + + if(choice=='Q'|| choice=='q') + { + break; + } + +} +return 0; +} diff --git a/C++/File folder/File13.exe b/C++/File folder/File13.exe new file mode 100644 index 0000000..16afed7 Binary files /dev/null and b/C++/File folder/File13.exe differ diff --git a/C++/File folder/File3.cpp b/C++/File folder/File3.cpp new file mode 100644 index 0000000..1b71b81 --- /dev/null +++ b/C++/File folder/File3.cpp @@ -0,0 +1,36 @@ +//This program writes content to the file +#include +#include +using namespace std; +int main() +{ + ofstream outputFile; + outputFile.open("Numbers.txt"); + int num1,num2,num3; + + cout<<"Taking the input to the file"<>num1; + + cout<<"Enter number2"<>num2; + + cout<<"Enter number3"<>num3; + + + //Write the numbers to the file + outputFile< +#include +#include +using namespace std; +int main() +{ + ofstream outputFile; + outputFile.open("Friends.txt"); + string name1,name2,name3; + cout<<"Writing the data to the file"< +#include +#include +using namespace std; +int main() +{ + ifstream inputFile; + inputFile.open("Friend.txt"); + string name; + cout<<"Reading the data from the file"<> name; + cout<> name; + cout<> name; + cout< +#include +using namespace std; +int main(){ + ifstream File; + File.open("Numbers.txt"); + int value1,value2,value3,sum; + + //open a file + File>>value1; + File>>value2; + File>>value3; + + //close file + File.close(); + + cout<<"Numbers extracted from file : " < +#include +using namespace std; +int main() +{ + ofstream outputFile; + outputFile.open("Sales.txt"); + int numOfdays; + double sales; + + cout<<"For how many days do you have sales? "<> numOfdays; + + for(int i=1;i<=numOfdays;i++) + { + cout<<"Sales for the day"<>sales; + outputFile < +#include +using namespace std; +int main() +{ + ofstream F; + F.open("Saless.txt"); + int days; + double sales; + cout<<"Number of days"<>days; + + for(int i=1;i<=days;i++) + { + cout<<"Sales for the day"<>sales; + + F< +//#include +//using namespace std; +//int main() +//{ +// ifstream F; +// F.open("Saless.txt"); +// int num; +// +// //Extract data untill end +// while(F >>num) +// { +// cout< +#include +using namespace std; +int main() +{ + ifstream F; + F.open("Saless.txt"); + int num; + while(F>>num) + + { + cout< +#include +#include +using namespace std; +int main() +{ + ifstream inputFile; + inputFile.open("Friends.txt"); + string name; + cout<<"Reading the data from the file"< +#include +using namespace std; +int main() +{ +int x=10; +int y=20; +int z=30; + + ofstream File; + File.open("Num.txt"); + + File< +#include +#include +using namespace std; +int main() +{ + ifstream inputFile; + inputFile.open("Friend.txt"); + string name; + cout<<"Reading the data from the file"<> name; + cout<> name; + cout<> name; + cout< +using namespace std; +int main() +{ +const int NUM_FISH = 20; +int fish[NUM_FISH]; +int x; +cout <<"user is going to enter how many fishes were caught by each fisherman "<>fish[i]; + //also can be done in this way + //cin >>x; + //fish[i]=x; +} +for(int i=0;i<20;i++) +{ + cout <<"fishes caught by "< +#include +using namespace std; +int main() +{ + ifstream F; + F.open("info.txt"); + int num; + + //check if input fiile exist or not + if(F) + { + while(F>>num) + { + cout +using namespace std; +int main() +{ + const int SIZE=5; + int num0[SIZE]={5,6,7,8,10}; + int lowest; + int count; + lowest = num0[0]; + for(int i=0;i +#include +using namespace std; +int main() +{ + ofstream outputFile; + outputFile.open("Demofile.txt"); + + cout<<"Now writing the data to the file"< +#include +using namespace std; +int main() +{ + ofstream outputFile; + outputFile.open("DemoFile1.txt"); + + //Now writing the data to the file + + cout<<"Now writi9ing the data to the file"< +using namespace std; +int main() +{ + int[] number={1,2,3}; + for(int val:number) + { + cout< +using namespace std; +int main(){ + + +int number[]={3,6,9}; +for(int val:number) +{ + cout< +#include +using namespace std; +void doublevalue(const int [], int); +void showvalue(int [], int); +int main() +{ + const int SIZE=5; + int num[SIZE]={1,2,3,4,5}; + showvalue(num,SIZE); + cout< +#include +using namespace std; +int main() +{ + const int ARRAY_SIZE=10; + int num[ARRAY_SIZE]; + int count =0; + ifstream inputFile; + inputFile.open("person.txt"); + + while(count>num[count]) + { + count++; + } + + inputFile.close(); + cout<<"Show array on screen"< +#include +using namespace std; +int main() +{ + const int SIZE=5; + int num[SIZE];; + int count =0; + ofstream outputFile; + + for(count=0;count>num[count]; + } + outputFile.open("Write.txt"); + for(count=0;count +using namespace std; +int main() +{ +const int SIZE=3; + int num[SIZE]; + cout<<"Input data"<>num[i]; + } + cout<<"Print array:"<