#include<iostream.h> #include<conio.h> main() { while(1) { long a,f,x,z,y; cout<<"Enter Your Cash: "; cin>>a; f=a/50; cout<<"50 Rial: "<<f<<endl; if((a%50)!=0) { z=(a%50)/30; cout<<"30 Rial: "<<z<<endl; if(((a%50)%30)!=0) { x=((a%50)%30)/20; cout<<"20 Rial: "<<x<<endl; if((((a%50)%30)%20)!=0) { y=((((a%50)%30)%20)/5); cout<<"5 Rial: "<<y<<endl; } } } } getch(); return 0; }
#include<iostream.h> #include<conio.h> main() { while(1) { int a; cout<<"Enter The Score: "; cin>>a; if((a<0)||(a>100))cout<<"The Score Is Out Of Range !"<<endl; else switch(a/10) { case 10: case 9:cout<<"A"<<endl;break; case 8:cout<<"B"<<endl;break; case 7:cout<<"C"<<endl;break; case 6:cout<<"D"<<endl;break; case 5:cout<<"E"<<endl;break; case 4: case 3: case 2: case 1: case 0:cout<<"F"<<endl;break; } } getch(); return 0; }
#include<iostream.h> #include<conio.h> const int n=20; void boublesort(int k[n]); main() { while(1) { int k[n]; for(int i=0;i<n;i++) { cout<<"Enter Your Numbers: "; cin>>k[i]; } boublesort(k); for(i=0;i<n;i++) cout<<k[i]<<" "; cout<<endl; } getch(); return 0; } void boublesort(int k[n]) { int temp=0; for(int i=1;i<n;i++) for(int j=0;j<n-1;j++) if(k[j]>k[j+1]) { temp=k[j]; k[j]=k[j+1]; k[j+1]=temp; } }
#include<stdio.h> #include<conio.h> #include<iostream.h> #define EOLN '\n' void main(){ void reverse(void); clrscr(); cout<<"Please Write Your Text Below :"<<'\n'; reverse(); } void reverse (void) { char c; if ((c=getchar()) != EOLN) reverse(); putchar(c); return; }
/* ============== Program Description ============= */ /* program name : pointer.cpp */ /* soale roze 3shanbe */ /* ================================================== */ #include <iostream.h> #include <conio.h> main() { int x=20; int y=50; int *p; p=&x; cout<<"p= "<<p<<endl; cout<<"*p= "<<*p<<endl; cout<<"++p= "<<++p<<endl; p=&x; cout<<"p++= "<<p++<<endl; p=&x; cout<<"*++P= "<<*++p<<endl; p=&x; cout<<"*P++= "<<*p++<<endl; p=&x; cout<<"(*P)++= "<<(*p)++<<endl; p=&x; cout<<"++(*P)= "<<++(*p)<<endl; getch(); return 0; }
<< توضیحات بیشتر و جداول مربوطه در ادامه مطلب
#include <iostream.h> #include <conio.h> #include <iomanip.h> int main() { int a=0,b=0,c,d=4,e=1,f=2,g,s=1,n; cout<<"which number do you like to show? "; cin>>n; c=2*n; while (a<n) { while (b<c) { cout<<" "; b++; } b=0; while (e<f) { s=f/2; if (e<=f/2) { cout<<setw(2)<<e; } else { s=f/2; while (1<g) { g=g-1; cout<<setw(2)<<g; } } e++; } e=1; f=f+2; g=(f/2); while (b<c) { cout<<" "; b++; } b=0; c=c-1; cout<<endl; a++; } a=1; b=0; d=4; e=1; c=c+2; f=f-4; g=(f/2); s=1; while (a<2*n) { while (b<c) { cout<<" "; b++; } b=0; while (e<f) { if (e<=f/2) { cout<<setw(2)<<e; } else { while (1<g) { g=g-1; cout<<setw(2)<<g; } } e++; } e=1; f=f-2; g=(f/2); while (b<c) { cout<<" "; b++; } b=0; c=c+1; cout<<endl; a++; } getch(); return 0; }
میزان نظرات تعیین کننده درج توضیحات است
/* ============== Program Description ============= */ /* program name : fibtab.cpp */ /* compute a valeu of a position in fib tab */ /* ================================================== */ #include <iostream.h> #include <conio.h> int fib (int n); main() { int n; clrscr(); cout<<"enter a position -->"; cin>>n; cout<<"the position "<<n<<" in fibonachi is "<<fib(n); getch(); return 0; } //end main //***************************** int fib (int n) { if (n<=1) return n; else return fib(n-2)+fib(n-1); }