Posts

Calculating Gross Pay (C++ Sample Program)

Coding With Farhan A C++ Program To Calculate Gross Pay #include <iostream> using namespace std; void printDescription(); void grossPay(); int main() { printDescription(); grossPay(); } void printDescription() { cout << "*************************************************************************" << endl; cout << "This program takes two numbers (pay rate and hours) and outputs gross pay. " << endl; cout << "*************************************************************************" << endl; } void grossPay() { int a, b, grosspay; cout << "Enter Pay Rate :- "; cin >> a; cout << "Enter Number Of Hours :- "; cin >> b; grosspay = a * b; cout << "Gross Pay Is :- " << "$" << grosspay; } Thank You I Hope You Will Like This Program If You Have Any Queries Let Me Know In The Comments Section

. An array stores details of 25 students (rollno, name, marks in three subjects). Write a program to create such an array and print out a list of students who have failed in more than one subject.

Coding With Farhan  We Are Considering The Fail Marks 50 Source Code  #include <iostream> using namespace std; struct student {     int roll;     char name[50];     float marks1, marks2, marks3; }; int main() {     student S[2];     for (int i = 0; i < 2; i++)     {         cout << "Enter Roll No :-  ";         cin >> S[i].roll;         cout << "Enter Name :- ";         cin >> S[i].name;         cout << "Enter Marks Of Three Subjects :- ";         cin >> S[i].marks1 >> S[i].marks2 >> S[i].marks3;     }     cout << "Students Failed In More Than 1 Subject" << endl;     for (int i = 0; i < 2; i++)     {         if ((S[i].marks1 < 50 && S[i].marks2 < 50) |...

Matching Last Character (C++ Sample Program)

// Coding With Farhan - A program to matches the last character of the name with the alphabet you want. I am using n. #include<iostream> // standard header file for input and output #include<cstring> // header file for using c-type string functions using namespace std; int main() // starting of the program { char full_name[50]; // taking an array of characters of size 50 cout << "Enter Your Full Name :- "; // show to the user what they have to give as a input cin.getline(full_name,50); // for taking input from the user int number_of_characters=strlen(full_name); // delcaring a variable and iniatializing it with the total length of the full name .... strlen function is used to calculate the whole length of the word  if(full_name[number_of_characters- 1] == 'n') // using if statement to match the last character of the full name to n, you can use any alphabet you want // number_of_character-1 means that the array of full_name is starting f...