Tim1212's Posts
Nairaland Forum › Tim1212's Profile › Tim1212's Posts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (of 26 pages)
Meet Johnathan MK, the best student with creativity in diib Academy on a concluded training on web programming. He created a portfolio website project with HTML5/CSS3. #diibacademy
|
diib™️ Nigeria launched an initiative through diib™️ Academy, a non-profit organisation and a subsidiary of diib™️ Nigeria to equip Youth nationwide on technology Skills involving: ~ Web Programming ~ System Programming ~ Machine Learning ~ Data Science ~ Robotics ~ Artificial Intelligence diib Academy extends tech skills to Taraba State, Donga LGA, Mararraba Town. In vision with Federal Government to reduce unemployment in the country and boost economy value through exporting technology to other countries. diib Academy just concluded the first-batch Web Programming training in Mararraba Town, equipping over 18 youths. Most of the students develop and hosted a portfolio website as a side project using HTML5/CSS3 and Javascript. Currently second-batch training has commenced since last week to equip more youths. diib Academy also equip NYSC Corp member in Mararraba Town on tech skills. diib Academy is willing to export and extend ICT skills across the country, where passionate folks are ready to learn tech skills. To battle unemployment, economic problem and boost technology in the country. www.facebook.com/110737283801491/posts/217058863169332/ More � |
Meet Johnathan MK, the best student with creativity in diib Academy on a concluded training on web programming. He created a portfolio website project with HTML5/CSS3. #diibacademy
|
diib™️ Nigeria launched an initiative through diib™️ Academy, a non-profit organisation and a subsidiary of diib™️ Nigeria to equip Youth nationwide on technology Skills involving: ~ Web Programming ~ System Programming ~ Machine Learning ~ Data Science ~ Robotics ~ Artificial Intelligence diib Academy extends tech skills to Taraba State, Donga LGA, Mararraba Town. In vision with Federal Government to reduce unemployment in the country and boost economy value through exporting technology to other countries. diib Academy just concluded the first-batch Web Programming training in Mararraba Town, equipping over 18 youths. Most of the students develop and hosted a portfolio website as a side project using HTML5/CSS3 and Javascript. Currently second-batch training has commenced since last week to equip more youths. diib Academy also equip NYSC Corp member in Mararraba Town on tech skills. diib Academy is willing to export and extend ICT skills across the country, where passionate folks are ready to learn tech skills. To battle unemployment, economic problem and boost technology in the country. www.facebook.com/110737283801491/posts/217058863169332/ More �
|
chrisUmendeche:I totally agree with you |
Tim1212:This program is applied in thermometer |
Tim1212:I will be explaining every single program starting from the beginning |
chukxy:What you asked is beyond the scope of this thread, though you have been cleared by others. Ask question pertaining to the C++ programs we have here. |
JiKing:Pick anyone, then we start from there |
#include <iostream> #include <iomanip> using namespace std; double add(double, double); double mutiply(double, double); double divide(double, double); double subtract(double, double); int main() { double a, b; cout << fixed << showpoint << setprecision(2); cout << "This program performs the basic arithmetic operation " <<"\nsuch as:[addition, mutiplication, division and subtraction] " << endl << endl; cout << "Enter the sum of two real number: "; cin >> a >> b; cout << endl; cout << a << " + " << b << " = " << add(a, b) << endl; cout << "Enter the product of two real number: "; cin >> a >> b; cout << endl; cout << a << " * " << b << " = " << mutiply(a, b) << endl; cout << "Enter the quotiant of two real number: "; cin >> a >> b; cout << endl; cout << a << " / " << b << " = " << divide(a, b) << endl; cout << "Enter the difference of two real number: "; cin >> a >> b; cout << endl; cout << a << " - " << b << " = " << subtract(a, b) << endl; return 0; } double add(double a, double b) { return (a + b ); } double divide(double a, double b) { return(a / b); } double mutiply(double a, double b) { return((a) * (b)); } double subtract(double a, double b) { return ((a) - (b)); } |
#include <iostream> #include <iomanip> #include <cmath> using namespace std; int factorial(int); int main() { int f; double x, sinX; int n; cout << "TIM1212" << endl; cout << "16CS/0201/xx"<< endl; cout << "POWER OPTION" << endl; cout << endl; cout << "Enter integer to find the factorial: "; cin >> n; if (n < 0) cout << "Negative number found " << endl; else f = factorial(n); cout << n << "! = " << f << endl; cout <<" Enter the value of x, to determine the 5th terms of Mac-Laurin series: "; cin >> x; cout << endl; sinX = x - pow(x, 3) / (factorial(3)) + pow(x, 5) / (factorial(5)) - pow(x, 7) / (factorial(7)) + pow(x, 9) / (factorial(9)); cout << "Sin(" << x << " = " << sinX << endl;return 0; } int factorial(int n) { if (n == 0) return 1; else return(n * factorial(n - 1)); } |
#include <iostream> #include <iomanip> using namespace std; int main() { double Dt; int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30; cout << fixed << showpoint << setprecision(2); cout << "To determine the determinant of 5 x 6 matrix " << endl; cout << "Enter the variables " << endl; cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6; cin >> a7 >> a8 >> a9 >> a10 >> a11 >> a12; cin >> a13 >> a14 >> a15 >> a16 >> a17 >> a18; cin >> a19 >> a20 >> a21 >> a22 >> a23 >> a24; cin >> a25 >> a26 >> a27 >> a28 >> a29 >> a30; Dt = ((a1) * (a8) * (a15) * ((a23) * (a30) - (a24) * (a29)) - ((a22) * (a30) - (a24) * (a28)) + ((a22) * (a29) - (a23) * (a28))) - ((a2) * (a7) * (a15) * ((a23) *(a30) - (a24) * (a29)) - ((a22) * (a30) - (a24) * (a28)) + ((a22) * (a29) - (a23) * (a28)) ) + ((a3) * (a7) * (a14) * ((a23) *(a30) - (a24) * (a29)) - ((a22) * (a30) - (a24) * (a28)) + ((a22) * (a29) - (a23) * (a28)) ) - ((a4) * (a7) * (a14) * ((a21) * (a30) - (a24) * (a29)) - ((a21) * (a30) - (a24) * (a28)) + ((a21) * (a29) - (a23) * (a27))) + ((a5) * (a7) * (a14) * ((a22) * (a30) - (a24) * (a28)) - ((a21) * (a30) - (a24) * (a27)) + ((a21) * (a28) - (a22) * (a27))) - ((a6) * (a7) * (a14) * ((a22) * (a29) - (a23) * (a27)) - ((a21) * (a29) - (a23) * (a26)) + ((a21) * (a27) - (a22) * (a26))); cout << "The determinant of the matrix is = " << Dt << endl; return 0; } |
#include <iostream> using namespace std; int main() { int f; int c; cout << "Enter temperature in Fahrenheit: "; cin >> f; cout << endl; c = static_cast<int>( 5.0 / 9 * (f - 32)); cout << f << " degree F = " << c << " degree C. " << endl; return 0; } |
#include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; int main() { string firstName; string secondName; double testScore; double sum = 0; char grade = ' '; int count = 0; ifstream inFile; ofstream outFile; inFile.open("test.txt" ;if (!inFile) { cout << "Cannot open input file. " << "program terminates!" << endl; return 1; } outFile.open("outData.out" ;outFile << fixed << showpoint << setprecision(2); inFile >> firstName >> secondName; inFile >> testScore; while (inFile) { sum = sum + testScore; count++; switch (static_cast<int> (testScore) / 10) { case 0: case 1: case 2: case 3: case 4: case 5: grade = 'F'; break; case 6: grade = 'D'; break; case 7: grade = 'C'; break; case 8: grade = 'B'; break; case 9: case 10: grade = 'A'; break; default: cout << "invalid score." << endl; } outFile << left << setw(12) << firstName << setw(12) << secondName << right << setw(4) << testScore << setw(2) << grade << endl; inFile >> firstName >> secondName; inFile >> testScore; } outFile << endl; if (count != 0) outFile << "Class Average: " << sum / count << endl; else outFile << "No data. " << endl; inFile.close(); outFile.close(); return 0; } input Steve Gill 89 Rita Johnson 91.5 Randy Brown 85.5 Seema Arora 76.5 Samir Mann 73 Output Steve Gill 89.00 B Rita Johnson 91.50 A Randy Brown 85.50 B Seema Arora 76.50 C Samir Mann 73.00 C Class Average: 83.10 |
#include <iostream> using namespace std; int main() { int count; int n; cout << "Enter the factorial value "; cin >> n; cout << endl; count = 2; while (count <= n) count = 1 * ++count; cout << "The factorial value of " << n << " is " << count << endl; return 0; } |
#include <iostream> using namespace std; int main() { int nth; int factNum; cout << "Enter the factorial value a number: "; cin >> factNum; cout << endl; for (nth = 1; factNum >= nth; nth++) { cout << (factNum - nth) << endl; } cout << " The value is = " << factNum * n << endl; return 0; } |
#include <iostream> using namespace std; int main() { int sum = 0; int num; cout << "Enter the sum of positive number: "; cin >> num; while (cin) { if (num < 0) { cout << "Negative number is found in the data!" << endl; break; } sum = sum + num; cin >> num; } cout << "The sum of the number entered is: " << sum << endl; return 0; } |
#include <iostream> using namespace std; int main() { int sum = 0; bool isNegative = false; int num; cout << "Enter sum of positive integers: "; cin >> num; cout << endl; while (cin && !isNegative) { if (num < 0) { cout << "Negative number found in the data! " << endl; isNegative = true; } else { sum = sum + num; cin >> num; } } cout << "The sum of number entered is: " << sum << endl; return 0; } |
#include <iostream> using namespace std; int main() { int num, temp, sum; cout << "Enter a positive integer: "; cin >> num; cout << endl; temp = num; sum = 0; do { sum = sum + num % 10; num = num / 10; } while (num > 0); cout << "The sum of the digits = " << sum << endl; if (sum % 9 == 0) cout << temp << " is divisible by 3 and 9" << endl; else if (sum % 3 == 0) cout << temp << " is divisible by 3, and not 9 " << endl; else cout << temp << " is not divisible by 3 or 9" << endl; return 0; } |
#include <iostream> using namespace std; int main() { int score; do { cout << "Enter a score between 0 and 50: "; cin >> score; cout << endl; } while (score < 0 || score > 50); return 0; } |
#include <iostream> using namespace std; int main() { int counter; int number, N; int odds = 0; int evens = 0; int zeros = 0; cout << "Please enter number of integers: " << "\n(positive, negative, or zeros). "; cin >> N; cout << endl; cout << "The number you entered are: " << endl; for (counter = 1; counter <= N; counter++) { cin >> number; cout << number << " "; switch (number % 2) { case 0: evens++; if (number == 0) zeros++; break; case 1: case -1: odds++; } } cout << endl; cout << "There are " << evens << " evens, " << "which includes " << zeros << " zeros. " << endl; cout << "The number of odds is: " << odds << endl; return 0; } |
#include <iostream> using namespace std; int main() { int counter; int sum = 0; int n; cout << "Enter the number of positve even " "integers to be added: "; cin >> n; cout << endl; for (counter = 2; counter <= n; counter = counter + 2) sum = sum + counter; cout << "The sum of the first " << "positive integer is " << sum << endl; return 0; } |
#include <iostream> using namespace std; bool main() { int previous1, previous2, current , counter, nthFibonacci; double y; cout << "Enter the first two Fibonacci " << "numbers: "; cin >> previous1 >> previous2; cout << endl; cout << "The first two Fibonaccci number are " << previous1 << " and " << previous2 << endl; cout << "Enter the position of the desired " << " Fibonacci number: "; cin >> nthFibonacci; cout << endl; if (nthFibonacci == 1) current = previous1; else if (nthFibonacci == 2) current = previous2; else { counter = 3; while (counter <= nthFibonacci) { current = previous2 + previous1; previous1 = previous2; previous2 = current; counter++; } } cout << "The Fibonacci at position " << nthFibonacci << " is " << current << endl; return false; } |
#include <iostream> using namespace std; typedef double d; const d PI = 3.14; int main() { d radius, circumference, area; cout << "Welcome to the circle creator." << endl; cout << "What would like the raduis of the circle be: "; cin >> radius; cout << endl; area = PI * radius * radius; circumference = PI * (radius * 2); cout << "The are of the circle is: " << area << endl << endl; cout << "The circumference of the circle is: " << circumference << endl << endl; cout << "Thank you for playing the circle game! " << endl; return 0; } |
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { int guess; int num; int noOfGuessess = 0; int chances = 5; bool isGuessed = false; srand(time(0)); num = rand() % 100; while ((noOfGuessess < 5) && (!isGuessed)) { cout << "Enter an integer greater than or equal to 0 and " << "\nless than 100: "; cin >> guess; cout << endl; noOfGuessess++; chances--; if (guess > 100) { cout << "Invalid guess! " << endl; isGuessed = true; } else if (guess == num) { cout << "WInner!. You guessed the correct number. " << endl; isGuessed = true; } else if (guess < num) cout << "Your guess is lower than the number.\n" << "Guess again!" << endl; else cout << "your guess is higher than the number.\n" << "Guess again!" << endl; cout << "you have: " << chances << " chances! " << endl; } if (!isGuessed) cout << "you loss!. The correct number is " << num << endl; return 0; } |
#include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; const double MINIMUM_BALANCE = 1000.00; const double SERVICE_CHARGE = 25.00; int main() { string name; int acountNumber; double beginningBalance = 0.0; double accountBalance = 0.0; double amountDeposited = 0.0; int numberOfDeposits = 0; double amountWithdrawn = 0.0; int numberOfWithdrawn = 0; double transactionAmount = 0.0; char transactionCode; double interestPaid = 0.0; bool isServiceCharge = false; ifstream inFile; ofstream outFile; inFile.open("acc.dat" ;if (!inFile) { cout << "Cannot open the file. \nProgram terminated. " << endl; return 0; } outFile.open("actfile.out" ;outFile << fixed << showpoint << setprecision(2); cout << "Data processing...." << endl; inFile >> name >> acountNumber >> beginningBalance; accountBalance = beginningBalance; inFile >> transactionCode >> transactionAmount; while (inFile) { switch (transactionCode) { case 'D': case 'd': accountBalance = accountBalance + transactionAmount; amountDeposited = amountDeposited + transactionAmount; numberOfDeposits++; break; case 'I': case 'i': accountBalance = accountBalance + transactionAmount; interestPaid = interestPaid + transactionAmount; break; case 'W': case 'w': accountBalance = accountBalance - transactionAmount; amountWithdrawn = amountWithdrawn + transactionAmount; numberOfWithdrawn++; if ((accountBalance < MINIMUM_BALANCE) && (!isServiceCharge)) { accountBalance = accountBalance - SERVICE_CHARGE; isServiceCharge = true; } if ((accountBalance < transactionAmount) || (amountWithdrawn > accountBalance)) { accountBalance = 0.0; amountWithdrawn = 0.0; numberOfWithdrawn = 0; cout << "Insufficient fund...." << endl; } break; default: cout << "Invalid transaction code " << endl; } inFile >> transactionCode >> transactionAmount; } outFile << "Account Name: " << name << endl; outFile << "Beginning Balance: $" << beginningBalance << endl; outFile << "Ending Balance: $" << accountBalance <<endl; outFile << "Interest Paid: $" << interestPaid <<endl << endl; outFile << "Amount Deposited: $" << amountDeposited << endl; outFile << "Number of Deposits: " << numberOfDeposits << endl << endl; outFile << "Amount Withdrawn: $" << amountWithdrawn << endl; outFile << "Number of withdrawn: " << numberOfWithdrawn << endl << endl; outFile << "Thank you for banking with us!" << endl; if (isServiceCharge) outFile << "Service Charge: $" << SERVICE_CHARGE << endl; inFile.close(); outFile.close(); return 0; } Input Tim 467456 23750.45 W 259.00 d 1200.00 W 75.00 D 589.55 I 249 W 345 w 32.89 d 200 d 7000 w 804 d 9000.65 w 100000 Output Account Name: Tim Beginning Balance: $23750.45 Ending Balance: $0.00 Interest Paid: $249.00 Amount Deposited: $17990.20 Number of Deposits: 5 Amount Withdrawn: $0.00 Number of withdrawn: 0 Thank you for banking with us! Service Charge: $25.00 |
#include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; int main() { double testScore; double average; double sum = 0; int count = 0; char grade; string firstName; string secondName; ifstream inFile; ofstream outFile; inFile.open("text.dat" ;if (!inFile) { cout << "Cannot open input file. " << "program terminated " << endl; return 1; } outFile.open("avgtxt.out" ;outFile << fixed << showpoint << setprecision(2); cout << "Data processing " << endl; inFile >> firstName >> secondName; inFile >> testScore; while (inFile) { sum = sum + testScore; count++; switch (static_cast<int>(testScore / 10)) { case 0: case 1: case 2: case 3: case 4: case 5: grade = 'F'; break; case 6: grade = 'D'; break; case 7: grade = 'C'; break; case 8: grade = 'B'; break; case 9: case 10: grade = 'A'; break; default: cout << "Invalid score." << endl; } outFile << left << setw(12) << firstName << setw(12) << secondName << right << setw(4) << testScore << setw(2) << grade << endl; inFile >> firstName >> secondName; inFile >> testScore; } if (count != 0) outFile << "Clasee Average: " << sum / count << endl; else outFile << "No data." << endl; inFile.close(); outFile.close(); return 0; } input Steve Gile 17.98 Rita Johnson 91.8 Randy Brown 85.5 Seema Arora 76.5 Samir Mann 73 Samantha McCoy 88.3 output Steve Gile 17.98 F Rita Johnson 91.80 A Randy Brown 85.50 B Seema Arora 76.50 C Samir Mann 73.00 C Samantha McCoy 88.30 B Clasee Average: 72.18 |
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { int num; bool isGuessed; int guess; srand(time(0)); num = rand() % 100; isGuessed = false; while (!isGuessed) { cout << "Enter an integer greater than or equal to 0 " << "and less than 100: "; cin >> guess; cout << endl; if (guess == num) { cout << "You guessed the correct number. " << endl; isGuessed = true; } else if (guess < num ) cout << "Your guess is lower than the number.\n Guess again!" << endl; else cout << "Your guess is higher than " << "the number.\n Guess again!" << endl; } return 0; } |
= " << sinX << endl;