var s : string[50]; i, j, k : word; f : boolean; function isSpace(ch : char) : boolean; begin isSpace := false; if ch = ' ' then isSpace := true; end; begin f := false; repeat j := 0; writeln('введите строку, состоящую из 2 слов'); readln(s); for i := 1 to length(s) do if isSpace(s[i]) then begin inc(j); k := i; end; if j =1 then f := true; until f; write(copy(s, k + 1, length(s)), ' ', copy(s, 1, k - 1)); end. недавно такую писала :)
i, j, k : word;
f : boolean;
function isSpace(ch : char) : boolean;
begin isSpace := false;
if ch = ' ' then isSpace := true;
end;
begin f := false;
repeat j := 0;
writeln('введите строку, состоящую из 2 слов');
readln(s);
for i := 1 to length(s) do
if isSpace(s[i]) then
begin
inc(j);
k := i; end;
if j =1 then f := true;
until f;
write(copy(s, k + 1, length(s)), ' ', copy(s, 1, k - 1));
end.
недавно такую писала :)
Вот, нашел на одном из сайтов: #include <iostream>
#include <conio.h>
#include <cstdlib>
#include <ctime>
using namespace std;
int main (){
srand(time(0));
int n, one, two, co=0, ol, k=0, var, sum1=0, sum2=0;
bool kto=true;
cout << "Privet davaii sigraem v kosti.\nPobedit tot u kogo suma 3 broskov budet bolshe\n\n";
while (k<3)
{
cout << "\n1 - Brositj kubik\n2 - Vijti\nViberi variant: ";
cin >> var;
if (var==1)
{
for (int j=0; j<=1; j++)
{
one=1+(rand()%6);
two=1+(rand()%6);
cout << "\n";
if (kto) cout << "\tTvoi kubiki\n";
if (!kto) cout << "\tMoi kubiki\n";
cout << "\n";
for (int i=1; i<=5; i++)
{
if (i==1) n=1;
else if (i==2 && one==1) n=2;
else if (i==2 && one==3 || i==2 && one==2) n=3;
else if (i==2 && one==4 || i==2 && one==5 || i==2 && one==6) n=4;
else if (i==3 && one==3 || i==3 && one==1 || i==3 && one==5) n=5;
else if (i==3 && one==2 || i==3 && one==4) n=2;
else if (i==3 && one==6) n=4;
else if (i==4 && one==1) n=2;
else if (i==4 && one==3 || i==4 && one==2) n=6;
else if (i==4 && one==4 || i==4 && one==5 || i==4 && one==6) n=4;
else if (i==5) n=7;
switch (n){
case 1:
cout << (char)201 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)187;
break;
case 2:
cout << (char)186 << " " << (char)186;
break;
case 3:
cout << (char)186 << " o " << (char)186;
break;
case 4:
cout << (char)186 << " o o " << (char)186;
break;
case 5:
cout << (char)186 << " o " << (char)186;
break;
case 6:
cout << (char)186 << " o " << (char)186;
break;
case 7:
cout << (char)200 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)205 << (char)188;
break;
}
if (co%2==0) {
cout << "\t";
i--;
ol=one;
one=two;}
else {
cout << endl;
one=ol; }
co++;
}
if (kto){
sum1=sum1+one+two;
kto=false;
continue;
}
if(!kto){
sum2=sum2+one+two;
kto=true;
}
}
}
else if (var==2) return 0;
else {
cout << "\n!!! Viberi variant 1 ili 2 !!!\n";
continue;}
k++;
}
cout << "\nTvoj rezultat = " << sum1 << endl << "Moj rezultat = " << sum2 << endl;
if (sum1>sum2)
cout << "\n\tTi pobedil ;)";
else cout << "\n\tTi proigral :(";
getch ();
}