#include <iostream.h> #include <conio.h> #include <stdio.h> #define number 4 struct lessonname{ char lesson1[30]; char lesson2[30]; char lesson3[30]; char lesson4[30]; char lesson5[30]; }; struct lessonmark{ float mark1; float mark2; float mark3; float mark4; float mark5; }; struct student{ int stdnum; struct lessonname ln; struct lessonmark lm; int age; char name[30]; }; struct student std[number]; int main(){ clrscr(); float ave[number]; int i; for(i=0;i<number;i++) { cout<<"Enter number of student"<<(i+1)<<" : "; cin>>std[i].stdnum; cout<<"Enter the lessons of student"<<(i+1)<<" : "; cin>>std[i].ln.lesson1>>std[i].ln.lesson2>>std[i].ln.lesson3 >>std[i].ln.lesson4>>std[i].ln.lesson5; cout<<"Enter the marks of student"<<(i+1)<<" : "; cin>>std[i].lm.mark1>>std[i].lm.mark2>>std[i].lm.mark3 >>std[i].lm.mark4>>std[i].lm.mark5; cout<<"Enter the age of studnet"<<(i+1)<<" : "; cin>>std[i].age; cout<<"Enter the name of student"<<(i+1)<<" : "; gets(std[i].name); } cout<<"\nAverage of students : "; for(i=0;i<number;i++) { cout<<std[i].stdnum<<" "; ave[i]=((std[i].lm.mark1+std[i].lm.mark2+std[i].lm.mark3 +std[i].lm.mark4+std[i].lm.mark5)/5); cout<<ave[i]<<endl; } cout<<"\nMashrotiha : "<<endl; for(i=0;i<number;i++) { if(ave[i]<10) cout<<std[i].name<<endl; } getch(); return 0; }
#include<iostream> #include<conio.h> using namespace std; int main() { main: system("DatE/t"); system("Time/T"); getch(); }
برنامه ارسالی از طرف آقای فرزاد امیر محمدیان
#include<iostream.h> #include<conio.h> #include<stdio.h> #include<string.h> int main() { int num,max=0; cout<<"enter num :"; cin>>num; while(num!=0) { if(num>max) max=num; cout<<"enter num :"; cin>>num; } cout<<"max num ="<<max<<endl; getch(); }
#include<iostream.h> #include<conio.h> #include<stdio.h> #include<string.h> int main() { int r,s,m,h; cout<<"sen ra bar hasbe rooz vared konid :"; cin>>r; s=r/365; r=r%365; m=r/30; r=r%30; h=r/7; r=r%7; cout<<"sene shoma :"<<s<<"sal "<<m<<"mah "<<h<<"hafte "<<r<<"rooz ast."; getch(); }
برنامه ارسالی از طرف خانم اسدی
#include <iostream.h> #include <conio.h> int main() { long num; int c=0; clrscr(); cout<<"enter a number:"; cin>>num; if (num==0) { cout<<"length of num:1"; getch(); return 0; } while (num !=0) { c++; num =num/10; } cout <<"length of num:" << c; getch(); return 0; }
#include <iostream.h> #include <conio.h> int main() { int x, y,c=0; cout<< "enter number:"; cin>> x; cout<< "enter part:"; cin>> y; if (y==0) { cout<<"result is undefined"; getch(); return 0; } while ((x-y)>=0) { c++; x=x-y; } cout<<"result is:" << c; getch(); return 0; }
برنامه ارسالی توسط خانم راستی
#include<iostream.h> #include<conio.h> void main( ) { clrscr( ); long int i,m=1,n; cout<<"enter a num"; cin>>n; for(i=1;i<=n;i+=2) m*=i; cout<<"product is ="<<m; getch( ); }