IMHO.WS

IMHO.WS (http://www.imho.ws/index.php)
-   Программирование (http://www.imho.ws/forumdisplay.php?f=40)
-   -   Помогите составить блок схемы алгоритма решения задачи которую уже написали в С (http://www.imho.ws/showthread.php?t=132812)

Face 29.05.2008 22:36

Помогите составить блок схемы алгоритма решения задачи которую уже написали в С
 
№1 задачГо

#include <iostream.h>
#include <conio.h>
main ()
{ clrscr();
int mas [100],M[100],k=0,l=999,n,i,s=1;
int sum=0;
cout<<"write amount elements of masiv :";
cin>>n;
cout<<"please,write this elements :\n";
for (i=1;i<=n;i++) cin >> mas[i];cout<<"YOUR masiv\n";
for (i=1;i<=n;i++) cout<<" "<<mas[i];
for (i=1;i<=n;i++)
if (mas[i]<0)
{sum+=mas[i];}
cout<<"\n"<<"sum of the negative elements = "<<sum;

k=mas[1];
int f=1;
for (i=1;i<=n;i++)
if (mas[i]>k)
{k=mas[i];
f=i;}
int g=1;
for (i=1;i<=n;i++)
if (mas[i]<l)
{l=mas[i];
g=i;}

if (g>f)
{for (i=f;i<=g;i++)
s*=mas[i];
cout<<"\n Multiplication of the elements between max and min = "<<s; }
if (f>g)
{for (i=g;i<=f;i++)
s*=mas[i];
cout<<"\n Multiplication of the elements between min and max = "<<s; }
getch();
return 0;
}


:молись:


№2 задачГо :confused:


#include <iostream.h>
#include <conio.h>
void main()
{clrscr();
int i,j,s,q;
do
{
cout<<"write first - ";
cin>>i;
cout<<"write second - ";
cin>>j;
s=i+j;
cout<<"result = "<<s<<"\n";
cout<<"Are you whant to restart this operation?\n";
cout<<"If you WANT, push- 1, if NO, push what you want\n";
cin>>q;
}
while (q==1) ;
cout<<"Good-bye)))";
getch();
}


:молись:

EvroStandart 30.05.2008 10:35

Ну и что у тебя не получается?
Обычную команду в прямоугольник, if в ромбик.

Face 30.05.2008 21:09

Цитата:

Сообщение от EvroStandart (Сообщение 1559819)
Ну и что у тебя не получается?
Обычную команду в прямоугольник, if в ромбик.

:) это понятно, но вот так просто не получится, ножно все так расписать как пологается, ато задачки то на курсовую...

Voland25 01.06.2008 18:37

Вложений: 1
Вот тебе для второй задачки пример... Первую сам по этому примеру сделаешь.


Часовой пояс GMT +4, время: 07:56.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.