Lab 3
Lab 3
Lab 3
NO MATRIC : BI22160523
ANSWER LAB 3
___________________________________________________________________________________
________
PRACTICE 1 :
#include <iostream>
using namespace std;
int main()
{
string n1, n2, n3;
cout << " Please enter three strings in lowercase: ";
cin >> n1 >> n2 >> n3;
cout << " Lexicographical order: ";
if (n1 < n2 && n1 < n3) {
cout << n1;
if (n2 < n3)
cout << n2 << n3;
else
cout << n3 << n2;
}
else if (n2 < n1 && n2 < n3) {
cout << n2;
if (n1 < n3)
cout << n1 << n3;
else
cout << n3 << n1;
}
else if (n3 < n2 && n3 < n1) {
cout << n3;
if (n2 < n1)
cout << n2 << n1;
else
cout << n1 << n2;
}
return 0;
}
PRACTICE 2 :
#include <iostream>
using namespace std;
int main()
{
char c;
bool isLowercaseVowel, isUppercaseVowel;
return 0;
}
PRACTICE 3 :
#include <iostream>
#include <iomanip>
// std :: setprecision()
using namespace std;
int main()
{
char car_type;
int hour_in, minute_in, hour_left, minute_left, tot_hour, tot_min, charges{},
penalty{};
//Penalty
if (hour_in > hour_left) {
penalty = 100;
}
else if (tot_hour < 24) {
penalty = 0;
}