#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 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() { char s; while(1) { cout<<"enter a word "; cin>>s; cout<<"ascii code of "<<s<<" is "; cout<<(int)s<<endl; } getch(); return 0; }
#include <iostream.h> #include <conio.h> int main() { int counter=0; clrscr(); do{ cout<<" "<<counter; } while(++counter<=10); getch(); return 0; }