#include
using namespace std;
double power(double num, int po);
int main()
{
double num;
int po;
cout << "Enter the value of number:" << endl;
cin >> num;
cout << "Enter the value of power:" << endl;
cin >> po;
cout << "Answer: " << power(num, po) << endl;
return 0;
}
double power(double num, int po)
{
double ans = 1;
for (int i = 0; i < po; i++)
{
ans = ans * num;
}
return ans;
}
#include
using namespace std;
void zeroSmaller(int &n1, int &n2);
int main()
{
int num1;
int num2;
cout<<"Enter the number_1:"<>num1;
cout << "Enter the number_1:" << endl;
cin >> num2;
zeroSmaller(num1,num2);
cout<<"The number 1 = "<
#include
#include
using namespace std;
const int row = 7;
const int col = 5;
void display(int matrix[][col], int row);
int total(int matrix[][col], int row);
float average(int matrix[][col], int row, int total);
int rowTotal(int matrix[][col], int row, int rowNum);
int colTotal(int matrix[][col], int row, int colNum);
int high_inRow(int matrix[][col], int row, int rowNum);
int low_inRow(int matrix[][col], int row, int rowNum);
int main()
{
int matrix[row][col] = {{1, 2, 3, 4, 5},
{6, 7, 8, 9, 10},
{11, 12, 13, 14, 15},
{16, 17, 18, 19, 20},
{21, 22, 23, 24, 25},
{26, 27, 28, 29, 30},
{31, 32, 33, 34, 35}};
int colNum = 0;
int rowNum = 0;
display(matrix, row);
cout << "The total sum of the all values = " << total(matrix, row) << endl;
cout << "The average of the all values = " << average(matrix, row, total(matrix, row)) << endl;
cout << "Enter the row number whose sum you want to find:" << endl;
cin >> rowNum;
cout << "The sum of the row " << rowNum << " = " << rowTotal(matrix, row, rowNum) << endl;
cout << "Enter the col number whose sum you want to find:" << endl;
cin >> colNum;
cout << "The sum of the col " << colNum << " = " << colTotal(matrix, row, colNum) << endl;
cout << "Enter the row whose highest value that you want to display:" << endl;
cin >> rowNum;
cout << "The highest value in the row " << rowNum << " :" << high_inRow(matrix, row, rowNum) << endl;
cout << "Enter the row whose highest value that you want to display:" << endl;
cin >> rowNum;
cout << "The lowest value in the row " << rowNum << " :" << low_inRow(matrix, row, rowNum) << endl;
return 0;
}
void display(int matrix[][col], int row)
{
// Display
cout << "Matrix :" << endl;
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
cout << left;
cout << setw(5) << matrix[i][j];
}
cout << endl;
}
cout << endl;
}
int total(int matrix[][col], int row)
{
int total;
// get-total
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
total += matrix[i][j];
}
}
return total;
}
float average(int matrix[][col], int row, int total)
{
// get-average
float average;
average = float(total) / (row * col);
return average;
}
int rowTotal(int matrix[][col], int row, int rowNum)
{
// get-rowTotal
int rowTotal;
for (int i = 0; i < col; i++)
{
rowTotal += matrix[rowNum][i];
}
return rowTotal;
}
int colTotal(int matrix[][col], int row, int colNum)
{
// get-colTotal
int colTotal;
for (int i = 0; i < row; i++)
{
colTotal += matrix[i][colNum];
}
return colTotal;
}
int high_inRow(int matrix[][col], int row, int rowNum)
{
// get-HighinRow
int high_inRow;
high_inRow = matrix[rowNum][0];
for (int i = 0; i < col; i++)
{
if (matrix[rowNum][i] > high_inRow)
{
high_inRow = matrix[rowNum][i];
}
}
return high_inRow;
}
int low_inRow(int matrix[][col], int row, int rowNum)
{
// get-lowinRow
int low_inRow;
low_inRow = matrix[rowNum][0];
for (int i = 0; i < col; i++)
{
if (matrix[rowNum][i] < low_inRow)
{
low_inRow = matrix[rowNum][i];
}
}
return low_inRow;
}
#include
using namespace std;
struct time{
int hrs;
int min;
int sec;
};
int hms_to_sec(int hrs, int min, int sec);
int main()
{
time t;
char temp;
char ch = 'y';
do
{
if (ch == 'y')
{
cout << "Enter the time in the format of 23:59:59 ";
cin >> t.hrs >> temp >> t.min >> temp >> t.sec;
cout << "The given time in the seconds :" << endl;
cout << hms_to_sec(t.hrs, t.min, t.sec) <<" sec"<< endl;
cout << "Again Want to continue:" << endl;
cin >> ch;
ch = tolower(ch);
}
else
{
cout << "Invalid Input:Please Enter the valid Input:" << endl;
cin >> ch;
ch = tolower(ch);
}
} while (ch != 'n');
cout << "\t\t\tQuiting.................." << endl;
return 0;
}
int hms_to_sec(int hrs, int min, int sec)
{
long long int seconds;
seconds = (((hrs * 60) + min) * 60) + sec;
return seconds;
}
#include
#include
using namespace std;
const int members = 2;
struct distanc_e
{
int feet;
float inches;
};
distanc_e largDis(distanc_e dis[], int size);
void show(distanc_e dis);
int main()
{
distanc_e dis[members];
for (int i = 0; i < members; i++)
{
cout << "Enter the Data for the Distance " << i + 1 << " :" << endl;
cout << "Enter the feets of the distance " << i + 1 << " :" << endl;
cin >> dis[i].feet;
cout << "Enter the inches of the distance " << i + 1 << " :" << endl;
cin >> dis[i].inches;
}
show(largDis(dis, members));
return 0;
}
void show(distanc_e dis)
{
cout << "The total feet are :" << dis.feet << "." << dis.inches << endl;
}
distanc_e largDis(distanc_e dis[], int size)
{
distanc_e total;
total.feet = 0;
total.inches = 0;
for (int i = 0; i < size; i++)
{
total.feet += dis[i].feet;
total.inches += dis[i].inches;
if (total.inches >= 12)
{
total.feet += 1;
total.inches -= 12;
}
}
return total;
}
#include
using namespace std;
struct time{
int hrs;
int mins;
int secs;
};
int time_to_secs(time t1);
void secs_to_time(long long int seconds);
int main()
{
const int size = 2;
time t1;
time t2[size];
long long int sum = 0;
cout << "First Part of the program:" << endl;
cout << "Enter hours:";
cin >> t1.hrs;
cout << "Enter minutes:";
cin >> t1.mins;
cout << "Enter seconds:";
cin >> t1.secs;
cout << "The total seconds in the given time :" << endl;
cout << time_to_secs(t1);
cout << endl;
cout << "Second part of the program:" << endl;
for (int i = 0; i < size; i++)
{
cout << "Enter the time " << i + 1 << endl;
cout << "Enter hours:";
cin >> t2[i].hrs;
cout << "Enter minutes:";
cin >> t2[i].mins;
cout << "Enter seconds:";
cin >> t2[i].secs;
cout << endl;
sum += time_to_secs(t2[i]);
}
cout << sum << endl;
secs_to_time(sum);
return 0;
}
int time_to_secs(time t1)
{
long long int seconds;
seconds = (((t1.hrs * 60) + t1.mins) * 60) + t1.secs;
return seconds;
}
void secs_to_time(long long int seconds)
{
time result;
result.hrs=seconds/3600;
result.mins=(seconds%3600)/60;
result.secs=seconds%60;
cout<<"The seconds to time format :"<
If you don't find any problem,in this website and if you have a very difficult assignment question that is not present on internet ,then you dont bother yourself,we are here to solve every problem of your life you just click on the Problem asking button and write your problem we slove the code of your problem and sent you on your email addres that you put in the sin up form.