برای باز کردن فایل پی دی اف در اندروید این تابع را بنویسید (خیلی از دوستان مشکل داشتن انشاالله که حل بشه مشکل شون )
String dir="/Attendancesystem";
public void displaypdf() {
File file = null;
file = new File(Environment.getExternalStorageDirectory()+dir+ "/sample.pdf");
Toast.makeText(getApplicationContext(), file.toString() , Toast.LENGTH_LONG).show();
if(file.exists()) {
Intent target = new Intent(Intent.ACTION_VIEW);
target.setDataAndType(Uri.fromFile(file), "application/pdf");
target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
Intent intent = Intent.createChooser(target, "Open File");
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
// Instruct the user to install a PDF reader here, or something
}
}
else
Toast.makeText(getApplicationContext(), "File path is incorrect." , Toast.LENGTH_LONG).show();
}
String dir="/Attendancesystem";
public void displaypdf() {
File file = null;
file = new File(Environment.getExternalStorageDirectory()+dir+ "/sample.pdf");
Toast.makeText(getApplicationContext(), file.toString() , Toast.LENGTH_LONG).show();
if(file.exists()) {
Intent target = new Intent(Intent.ACTION_VIEW);
target.setDataAndType(Uri.fromFile(file), "application/pdf");
target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
Intent intent = Intent.createChooser(target, "Open File");
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
// Instruct the user to install a PDF reader here, or something
}
}
else
Toast.makeText(getApplicationContext(), "File path is incorrect." , Toast.LENGTH_LONG).show();
}
landscape
چلو گیری از landscape
شدن اکتیویتی
را های مختلفی وجود داره👇
روش اول
<activity android:name=".SomeActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" />
روش دوم برای جلو گیری از land scape
این کد را به فایل
AndroidManifest.xml
اضافه کن یا راه بهتر کد زیر را
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
در تابع onCreate()
چلو گیری از landscape
شدن اکتیویتی
را های مختلفی وجود داره👇
روش اول
<activity android:name=".SomeActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" />
روش دوم برای جلو گیری از land scape
این کد را به فایل
AndroidManifest.xml
اضافه کن یا راه بهتر کد زیر را
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
در تابع onCreate()
امسال تولد ۱۲۶ سالگى چارلى چاپلين است. روز خوبى است براى ياداورى ٣ جمله تاثير گذار او:
١. هيچ چيز در اين جهان جاودانه نيست حتى مشكلات و بد بيارى هاى ما
٢. من قدم زدن تو بارون را دوست دارم چون كسى نميتونه اشكامو ببينه
٣. بيهوده ترين روز در زندگى اون روزيه كه ما نخنديم
چارلى ميگويد: پس از كلى فقر، به ثروت و شهرت رسيدم . اموخته ام كه با پول ... ميتوان ساعت خريد، ولى زمان نه ... ميتوان مقام خريد، ولى احترام نه ... ميتوان كتاب خريد، ولى دانش نه... ميتوان دارو خريد ولى سلامتى نه، ميتوان رختخواب خريد، ولى خواب راحت نه ...
ارزش ادمها به دارايى انها نيست به معرفت انهاست
تقدیم به دوستان بامعرفت
١. هيچ چيز در اين جهان جاودانه نيست حتى مشكلات و بد بيارى هاى ما
٢. من قدم زدن تو بارون را دوست دارم چون كسى نميتونه اشكامو ببينه
٣. بيهوده ترين روز در زندگى اون روزيه كه ما نخنديم
چارلى ميگويد: پس از كلى فقر، به ثروت و شهرت رسيدم . اموخته ام كه با پول ... ميتوان ساعت خريد، ولى زمان نه ... ميتوان مقام خريد، ولى احترام نه ... ميتوان كتاب خريد، ولى دانش نه... ميتوان دارو خريد ولى سلامتى نه، ميتوان رختخواب خريد، ولى خواب راحت نه ...
ارزش ادمها به دارايى انها نيست به معرفت انهاست
تقدیم به دوستان بامعرفت
ماشین حساب در محیط کنسول #include <iostream>
using namespace std;
void cls()
{
system("cls");
}
int number1, number2;
void Getnumber(); //امضا تابع گرفتن اعداد
int sum(); //امضا تابع جمع
int mul(); // امضا تابع ضرب
float mydiv(); // امضا تابع تقسیم
int min(); // امضا تابع تفریق
int main()
{
char ch;
while (1)
{
cout « " g = Getnumber " « endl;
cout « " * = zarb " « endl;
cout « " + = jam " « endl;
cout « " - = tafrigh" « endl;
cout « " / = taghsim" « endl;
cout « " x = exit " « endl;
cout « "please vared Get_number (g) :";
cin » ch;
cls();
switch (ch)
{
case 'g':Getnumber();
break;
case '*':
{
int m;
m = mul();
cout « "mul is : " « m « endl;
}
break;
case '+': cout « "sum is : " « sum() « endl;
break;
case '-': cout « "min is : " « min() « endl;
break;
case '/': cout « "mydiv is : " « mydiv() « endl;
break;
case 'x':exit(0);
break;
}
}
return 0;
}
void Getnumber()
{
cout « "please vared konid number1 :";
cin » number1;
cout « "please vared konind number2 :";
cin » number2;
}
int sum() // بدنه تابع جمع
{
void Getnumber();
return (number1 + number2);
}
int mul() // بدنه تابع ضرب
{
return (number1 * number2);
}
float mydiv() // بدنه تابع تقسیم
{
return (number1 / (float)number2);
}
int min() // بدنه تابع تفریق
{
return (number1 - number2);
}
//تابع های سینوس . کسینوس . تانژانت .کتانژانت .رادیکال به همین صورت است
using namespace std;
void cls()
{
system("cls");
}
int number1, number2;
void Getnumber(); //امضا تابع گرفتن اعداد
int sum(); //امضا تابع جمع
int mul(); // امضا تابع ضرب
float mydiv(); // امضا تابع تقسیم
int min(); // امضا تابع تفریق
int main()
{
char ch;
while (1)
{
cout « " g = Getnumber " « endl;
cout « " * = zarb " « endl;
cout « " + = jam " « endl;
cout « " - = tafrigh" « endl;
cout « " / = taghsim" « endl;
cout « " x = exit " « endl;
cout « "please vared Get_number (g) :";
cin » ch;
cls();
switch (ch)
{
case 'g':Getnumber();
break;
case '*':
{
int m;
m = mul();
cout « "mul is : " « m « endl;
}
break;
case '+': cout « "sum is : " « sum() « endl;
break;
case '-': cout « "min is : " « min() « endl;
break;
case '/': cout « "mydiv is : " « mydiv() « endl;
break;
case 'x':exit(0);
break;
}
}
return 0;
}
void Getnumber()
{
cout « "please vared konid number1 :";
cin » number1;
cout « "please vared konind number2 :";
cin » number2;
}
int sum() // بدنه تابع جمع
{
void Getnumber();
return (number1 + number2);
}
int mul() // بدنه تابع ضرب
{
return (number1 * number2);
}
float mydiv() // بدنه تابع تقسیم
{
return (number1 / (float)number2);
}
int min() // بدنه تابع تفریق
{
return (number1 - number2);
}
//تابع های سینوس . کسینوس . تانژانت .کتانژانت .رادیکال به همین صورت است
برنامه نویسی هیلتن
Class22.wmv
#include <iostream> چاپ ستاره در سیپلاس پلاس کار با حلقه های تودر تو
using namespace std;
int main()
{
//****
//***
//**
//*
int n;
cout « "Enter number :";
cin » n;
for (int i = n; i >= 1; i--)
{
//for (int j = 1; j <= 5-i; j++)
for (int j = 1; j <= i;j++)
{
cout « "*";
}
cout « endl;
}
return 0;
} //------------------------------------------------------------------------------------------ #include <iostream>
using namespace std;
int main()
{
//*
//**
//***
//****
int n;
cout « "Enter count star : ";
cin » n;
cout « endl;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; j++)
{
cout « "*";
}
cout « endl;
}
return 0;
} //---------------------------------------------------------------------------------------------------------- #include <iostream>
using namespace std;
void o();
void m();
void i();
void d();
int main()
{
cout « endl « "\t" « "___________________Welcome to C++________________________" « endl « endl « "\t";
o();
cout « "_________________________________________________________" « "\t" « endl « endl « "\t";
m();
cout « "_________________________________________________________" « "\t" « endl « endl « "\t";
i();
cout « "_________________________________________________________" « "\t" « endl « endl « "\t";
d();
cout « "_________________________________________________________" « "\t" « endl « endl ;
cout « "\tomid sotooni" « endl « "\t";
cout « "_________________________________________________________" « "\t" « endl « endl;
return 0;
}
void o()
{
for (int a = 1; a < 10; a++)
{
for (int c = 1; c <= a; c++)
{
cout « a;
}
cout « endl « "\t";
}
}
void m()
{
for (int a = 1; a <= 10; a++)
{
for (int c = a - 1; c > 0; c--)
cout « " ";
for (int c = 10; c >= a; c--)
{
if (c <= 9)
cout « (a);
}
cout « endl « "\t";
}
}
void i()
{
for (int a = 1; a <= 10; a++)
{
for (int c = 1; c <= a; c++)
{
cout « "*";
}
cout « endl « "\t";
}
}
void d()
{
for (int a = 1; a <= 10; a++)
{
for (int c = 10; c >= a; c--)
{
cout « "*";
}
cout « endl « "\t";
}
}
using namespace std;
int main()
{
//****
//***
//**
//*
int n;
cout « "Enter number :";
cin » n;
for (int i = n; i >= 1; i--)
{
//for (int j = 1; j <= 5-i; j++)
for (int j = 1; j <= i;j++)
{
cout « "*";
}
cout « endl;
}
return 0;
} //------------------------------------------------------------------------------------------ #include <iostream>
using namespace std;
int main()
{
//*
//**
//***
//****
int n;
cout « "Enter count star : ";
cin » n;
cout « endl;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; j++)
{
cout « "*";
}
cout « endl;
}
return 0;
} //---------------------------------------------------------------------------------------------------------- #include <iostream>
using namespace std;
void o();
void m();
void i();
void d();
int main()
{
cout « endl « "\t" « "___________________Welcome to C++________________________" « endl « endl « "\t";
o();
cout « "_________________________________________________________" « "\t" « endl « endl « "\t";
m();
cout « "_________________________________________________________" « "\t" « endl « endl « "\t";
i();
cout « "_________________________________________________________" « "\t" « endl « endl « "\t";
d();
cout « "_________________________________________________________" « "\t" « endl « endl ;
cout « "\tomid sotooni" « endl « "\t";
cout « "_________________________________________________________" « "\t" « endl « endl;
return 0;
}
void o()
{
for (int a = 1; a < 10; a++)
{
for (int c = 1; c <= a; c++)
{
cout « a;
}
cout « endl « "\t";
}
}
void m()
{
for (int a = 1; a <= 10; a++)
{
for (int c = a - 1; c > 0; c--)
cout « " ";
for (int c = 10; c >= a; c--)
{
if (c <= 9)
cout « (a);
}
cout « endl « "\t";
}
}
void i()
{
for (int a = 1; a <= 10; a++)
{
for (int c = 1; c <= a; c++)
{
cout « "*";
}
cout « endl « "\t";
}
}
void d()
{
for (int a = 1; a <= 10; a++)
{
for (int c = 10; c >= a; c--)
{
cout « "*";
}
cout « endl « "\t";
}
}