task 1;-
#include <iostream>
using namespace std;
int main()
{
int age;
cout<< " ENTER YOUR AGE ";
cin >> age;
switch (age)
{
case 19:
cout << "your are welcome";
break;
case 100:
cout << "get out ";
break;
default:
cout << "go to hell";
break;
}
}
task 2 :-
//2D array
#include <iostream>
using namespace std;
int main()
{
int marks[2][2] = { {3,4},{4,5} };
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
cout <<"\t" << marks[i][j];
}
}
}
TASK 3 :_
was about break and continue
TASK 4 :_
#include <iostream>
#include <string>
using namespace std;
typedef struct numbers {
int keys;
int num;
string data_type;
}a;
int main()
{
a one;
a two;
one.keys = 32;
one.num = 1;
one.data_type = 'o';
two.data_type = 'int';
cout << one.keys;
cout << two.data_type;
}
Comments
Post a Comment