,   CyberForum.ru

. . - C++

 
Dima960522
0 / 0 / 0
: 27.05.2013
: 6
27.05.2013, 22:46     . . #1
: :
- (-
,,,,,);
- 1- (, -
, , , , );
- (, -
, , , , -
,, ,);
- (,
, , , , , ,,,,).

, .
:
- -
;
- 1-
- ;
- ;
- .
:



:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <locale>
using namespace std;
int main()
{
    char* sushim [] = {"-","","","", "", ""};
    char* glag [] = {"", "", "", "", "", ""};
    char* pril [] = {"", "", "", "", "", "","", ""};
    char* sushvin [] = {"", "", "", "", "", "", ""};
    int a,b=0,s1,s2,s3,s4;
    setlocale(LC_ALL, ".1251");
    cout <<"  ?\n" ;
    scanf("%d", &a);
    srand(0);
    while (a!=b)
    {
    b++;
    s1=rand();
    s2=rand();
    s3=rand();
    s4=rand();
    setlocale(LC_ALL, ".1251");
    cout <<"  "<<b  << " = " <<sushim [s1%6];
    setlocale(LC_ALL, ".1251");
    cout <<" " << glag [s2%6];
    setlocale(LC_ALL, ".1251");
    cout <<" " << pril [s3%8];
    setlocale(LC_ALL, ".1251");
    cout <<" " << sushvin [s4%7] << "\n";
    }
    return 0;
    
}
. , char* sushim [] = {"-","","","", "", ""};

:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <locale>
using namespace std;
int main()
{
int i=0;
char* token;
const char razdeliteli[] =",";
char buff [BUFSIZ];
char* sushim [BUFSIZ];// = {"-","","","", "", ""};
char* glag [BUFSIZ];// = {"", "", "", "", "", ""};
char* pril [BUFSIZ];// = {"", "", "", "", "", "","", ""};
char* sushvin [BUFSIZ];// = {"", "", "", "", "", "", ""};
int a,b=0,s1,s2,s3,s4;
 
setlocale(LC_ALL, ".1251");
cout "   . : \n" ;
gets(buff);
 
token=strtok(buff,razdeliteli);//   
while(token!=NULL)//     
{
strcpy(sushim[i], token); //     
i++;
}
}
:
   .   .       
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
27.05.2013, 22:46     . .
:

: C++
C++
. C++
C++ .
C++
C++
C++
C++



:
.
Dima960522
0 / 0 / 0
: 27.05.2013
: 6
28.05.2013, 02:02  []     . . #2
, . , - :


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <locale>
using namespace std;
int main()
{
int i=0,k=0;
char* token;
int a,b=0,s1,s2,s3,s4,s11,s22,s33,s44;
const char razdeliteli[] =",";
char buff[BUFSIZ] ;

char* sushim[BUFSIZ];// = {"-","","","", "", ""};
char* glag [BUFSIZ];// = {"", "", "", "", "", ""};
char* pril [BUFSIZ];// = {"", "", "", "", "", "","", ""};
char* sushvin [BUFSIZ];// = {"", "", "", "", "", "", ""};

for(int i=0;i<BUFSIZ;i++)
{
sushim[i]=new char[BUFSIZ];
glag[i]=new char[BUFSIZ];
pril[i]=new char[BUFSIZ];
sushvin[i]=new char[BUFSIZ];
}


setlocale(LC_ALL, ".1251");
cout <<" . : \n" ;
gets(buff);

token=strtok(buff,razdeliteli);//

while(token!=NULL)//
{
strcpy(sushim[k], token); //
token=strtok(NULL,razdeliteli);//
k++;
}
memset(buff, 0, sizeof(buff));
s11=k;
k=0;

setlocale(LC_ALL, ".1251");
cout <<" : \n" ;
gets(buff);

token=strtok(buff,razdeliteli);//

while(token!=NULL)//
{
strcpy(glag[k], token); //
token=strtok(NULL,razdeliteli);//
k++;
}
memset(buff, 0, sizeof(buff));
s22=k;
k=0;


setlocale(LC_ALL, ".1251");
cout <<" : \n" ;
gets(buff);

token=strtok(buff,razdeliteli);//

while(token!=NULL)//
{
strcpy(pril[k], token); //
token=strtok(NULL,razdeliteli);//
k++;
}
memset(buff, 0, sizeof(buff));
s33=k;
k=0;


setlocale(LC_ALL, ".1251");
cout <<" . : \n" ;
gets(buff);

token=strtok(buff,razdeliteli);//

while(token!=NULL)//
{
strcpy(sushvin[k], token); //
token=strtok(NULL,razdeliteli);//
k++;
}
memset(buff, 0, sizeof(buff));
s44=k;
k=0;


setlocale(LC_ALL, ".1251");
cout <<" ?\n" ;
scanf("%d", &a);
srand(0);
while (a!=b)
{
b++;
s1=rand();
s2=rand();
s3=rand();
s4=rand();
setlocale(LC_ALL, ".1251");
cout <<" "<<b;
setlocale(LC_ALL, ".866");
cout << " = " <<sushim [s1%s11];
setlocale(LC_ALL, ".866");
cout <<" " << glag [s2%s22];
setlocale(LC_ALL, ".866");
cout <<" " << pril [s3%s33];
setlocale(LC_ALL, ".866");
cout <<" " << sushvin [s4%s44] << "\n";
}
return 0;

}
Yandex
28.05.2013, 02:02     . .

: 15:48. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
@Mail.ru