RSS
понеділок, 08.03.2010
понеділок, 01.03.2010

// 7.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdlib.h>
#include <malloc.h>
#include <iostream.h>
#include <new>
struct item
{
char name[40];
int age;
struct item *next, *prev;
};

///////////////////////////////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
int nE;
cout<<"vvedite kol-vo elementov massiva:"<<endl;
cin>> nE;
int* pSize= new int [nE];
int sum=0;
cout<<"poluchen massiv:\n";
for(int i=0;i<=nE; i++)
{
*pSize=rand();
sum+=*pSize;
cout<<*pSize<<endl;
pSize++;
}

cout<<"Summa elementov massiva ="<<sum<<endl;
pSize=0;
delete [] pSize;
return 0;
}




понеділок, 22.02.2010
http://depositfiles.com/files/7zjr8id6q

// 6.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream.h>


int main(int argc, char* argv[])

{ ///// 2 задание
enum mark { firstQuarter, secondQuarter, thirdQuarter, fourthQuarter}; // элементы перечисления получают значения по порядку начиная с 0
int storeMark[3]; // массив в котором будем использовать индексацию элементами перечисления
cout<<"vvedite ocenku za 1 quarter:"<<endl;
cin>>storeMark[firstQuarter]; // сохраняется в [0] элемент массива, т.к. firstQuarter в перечислении =0
cout<<"vvedite ocenku za 2 quarter:"<<endl;
cin>>storeMark[secondQuarter];

if( storeMark[firstQuarter] < storeMark[secondQuarter] )
{
cout<<"v pervom kvotere vi uchilis huzhe chem co vtorom"<<endl;
}
else if ( storeMark[firstQuarter] > storeMark[secondQuarter] )
{
cout<<"v pervom kvotere vi uchilis luchshe chem co vtorom"<<endl;
}
else
{
cout<<"vi uchilis odinakovo v pervom i vtorom kvotere"<<endl;
}

cout<<"vvedite ocenku za 3 quarter:"<<endl;
cin>>storeMark[thirdQuarter];
cout<<"vvedite ocenku za 4 quarter:"<<endl;
cin>>storeMark[fourthQuarter];

int averageMark = (storeMark[thirdQuarter] + storeMark[fourthQuarter])/2; // считаем средний балл за 2 семестр
cout<<"sredniaya ocenka za 2 semestr: "<< averageMark <<"\n";
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///// 3 задание

union
{
char cValue;
int iValue;
unsigned int uiValue;
float fValue;
double dValue;
long LValue;
char str[20];
}
uString[50]; // массив элементов типа union

int iSum=0;
unsigned int uiSum=0;
long LSum=0;

for( int i=0; i<=50; i++)
{
if(i%3==0)
{ uString[i].iValue=rand(); // запись в элемент удовлетворяющий условию псевдослучайного значения вызовом функции rand()
iSum+=uString[i].iValue;
}
if(i%3==1)
{ uString[i].uiValue=rand();
uiSum+=uString[i].uiValue;
}
if(i%3==2)
{ uString[i].LValue=rand();
LSum+=uString[i].LValue;
}


}

cout<<"Summa elementov tipa INT = "<<iSum<<endl;
cout<<"Summa elementov tipa UNSIGNED INT = "<<uiSum<<endl;
cout<<"Summa elementov tipa LONG = "<<LSum<<endl;

////////////////////////////////////////////////////////////////////////////

///// 4 задание

struct PersonalInfo
{
char studentName[20];
char studentSurname[20];
char creditBook[20];
char groupID[20];
char birthDay[20];
char address[40];
};


PersonalInfo myInfo; // создание обьекта класса
printf("vvedite svoe imya:\n");
scanf("%s", &myInfo.studentName);
printf("vvedite svoy familiyu: \n");
scanf("%s", &myInfo.studentSurname);
printf("vvedite nomer vashey zachetki:\n ");
scanf("%s", &myInfo.creditBook);
printf("vvedite vashu gruppu: \n");
scanf("%s", &myInfo.groupID);
printf("data rozhdenia (DD.MM.GG) :\n") ;
scanf("%s", &myInfo.birthDay);
printf("Vash domashniy adress: \n");
scanf("%s", &myInfo.address);
cout<<"Proverte pravilnost dannih:\n " <<myInfo.studentName<<"\n"
<<myInfo.studentSurname<<"\n"
<<myInfo.creditBook<<"\n"
<<myInfo.groupID<<"\n"
<<myInfo.birthDay<<"\n"
<<myInfo.address<<endl;


//////////////////////////////////

///// 5 задание

struct someData

{
char initials[5];
char weight[5];
char age[5];
};


someData array[10];// создание массива обьектов структуры
for( i=0; i<3;i++)
{// заполняем поля первых трех обьектов (0,1,2)
cout<<"Vvod dannih o "<<i+1<<" studente\n";
cout<<"vvedite inicialy:";
cin>> array[i].initials;
cout<<"vvedite ves:";
cin>> array[i].weight;
cout<<"vvedite vozrast:";
cin>> array[i].age;

}

///// 6 задание

for(i=0;i<3;i++)
{// выводим на экран поля первых трех обьектов
someData* pointer=&array[i];// обьявляем указатель на структуру
// указатель указывает на текущий элемент массива обьектов
cout<<i+1<<"student: "<<endl;
cout<<pointer->initials<<endl;
cout<<pointer->weight<<endl;
cout<<pointer->age<<endl;
}

return 0;
}

понеділок, 15.02.2010
вівторок, 09.02.2010
неділя, 07.02.2010

Расписание на 3 квотер (1 и 2 неделя) ФИКТ

 

 

3квотер.rar на FileShare.in.ua