13.9k views

Te jene te formatit PDF dhe nese e mundur ne gjuhen shqipe sepse nuk di mire anglisht...Faleminderit

reopened | 13.9k views

Algoritmet ne C++

Ushtrime ne C++

Ushtrime te tjera ne C++

Bazat e C++

Te gjithe librat mund te shkarkohen nga cdo pajisje dhe jane ne formatin PDF, Shqip. Suksese

nga Mjeshtër (7.4k points)

Me dergo nje email ne kete adrese dhe te dergoj disa leksione per bazat ne C++ ne shqip

zanaisaku01@gmail.com

nga
nga (960 points)

Display Largest Element of an array

#include <iostream>
using namespace std;

int main()
{
int i, n;
float arr;

cout << "Enter total number of elements(1 to 100): ";
cin >> n;
cout << endl;

// Store number entered by the user
for(i = 0; i < n; ++i)
{
cout << "Enter Number " << i + 1 << " : ";
cin >> arr[i];
}

// Loop to store largest number to arr
for(i = 1;i < n; ++i)
{
// Change < to > if you want to find the smallest element
if(arr < arr[i])
arr = arr[i];
}
cout << "Largest element = " << arr;

return 0;
}

Check Palindrome Number

#include <iostream>
using namespace std;

int main()
{
int n, num, digit, rev = 0;

cout << "Enter a positive number: ";
cin >> num;

n = num;

do
{
digit = num % 10;
rev = (rev * 10) + digit;
num = num / 10;
} while (num != 0);

cout << " The reverse of the number is: " << rev << endl;

if (n == rev)
cout << " The number is a palindrome.";
else
cout << " The number is not a palindrome.";

return 0;
}
nga Mjeshtër (7.4k points)

http://gen.lib.rus.ec/search.php?mode=last
ky linku shkarkon libra pafund

nga (530 points)
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int mdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int DaysinWeek = 0;
int year;
int day;
int FirstDayOfMonth = 0;
int month = 1;
cout << "Calendar Program" << endl << endl;
cout << "Please enter the year: ";
cin >> year;
if (year < 0)
{cout << "The year must be greater than or equal to 0!" << endl;
return 0;}
cout << "Please enter the day of the week of January 1st." << endl;
cout << "Enter 0 for Sunday, 1 for Monday, ..., 6 for Saturday: ";
cin >> day;
if (day < 0 || day > 6)
{cout << "The day of January 1st must be between 0 and 6!" << endl;
return 0;}
cout << endl << endl;
// Print this year's calendar
for (int month = 0; month < 12; ++month) {
{
for (int i = 0; i < DaysinWeek; ++i)
{cout << setw(3) << " ";}
if (month == 0)
{cout << "January \n";}
if (month == 1)
{cout << "February \n";
if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
mdays = 29;}
if (month == 2)
{cout << "March \n";}
if (month == 3)
{cout << "April \n";}
if (month == 4)
{cout << "May \n";}
if (month ==5)
{cout << "June \n";}
if (month == 6)
{cout << "July \n";}
if (month == 7)
{cout << "August \n";}
if (month == 8)
{cout << "September \n";}
if (month == 9)
{cout << "October \n";}
if (month == 10)
{cout << "November \n";}
if (month == 11)
{cout << "December \n";}
}
//spaces
for (int i = 0; i < day; i++)
{cout << "  ";
}
//Determine where the first day begins
day = 0;
for (FirstDayOfMonth; FirstDayOfMonth < day; ++FirstDayOfMonth)
{
cout << setw(3);
}
// Print this month's calendar
for (int mday = 0; mday < mdays[month]; ++mday) {
cout << setw(3) << mday + 1;
DaysinWeek++;
if (DaysinWeek == 7) {
cout << "\n" << setw(3);
DaysinWeek = 0;
}
}
// Set up for the next month
if (DaysinWeek != 7) {
cout << "\n";
}
cout << endl;
day = DaysinWeek + 1;
}
return 0;
}
nga Mjeshtër (7.4k points)