- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Максимальная сумма элементов из нескольких массивов(функция с переменным числом параметров)
- •Int main()
- •Int main()
- •Int main()
- •Замена абсолютно любых слов местами (просто в программе цифорки нужные поменять) Где цифры жирные там менять по ситуации
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Int main()
- •Строка в числа(в комментах код для подсчёта количества слов или чисел в строке рекурсией, это тоже где-то надо, вроде бы)
- •Int main()
- •Int main()
- •Int main()
Int main()
{
char *string1,*string2;
int size1,size2,size,lenght1,lenght2,position;
printf("Enter,how many symbols do you want in the first string: ");
scanf("%d",&size1);
printf("Enter,how many symbols do you want in the second string: ");
scanf("%d",&size2);
system("cls");
string1=(char*)malloc(size1+1*sizeof(char));
string2=(char*)malloc(size2+1*sizeof(char));
printf("Enter string number 1: ");
lenght1=GetStr(string1,size1);
system("cls");
printf("Enter string number 2: ");
lenght2=GetStr(string2,size2);
system("cls");
printf("Enter,where do you want to concentanate the second string: ");
scanf("%d",&position);
system("cls");
size=lenght1+lenght2+1;
if(lenght1>=lenght2)
{
Cancentaticon(string1,string2,position);
printf("\n%s",string1);
}
else
{
Cancentaticon(string2,string1,position);
printf("\n%s",string2);
}
free(string1);
free(string2);
getch();
return 0;
}
Вывод чисел в обратном порядке
#include<stdio.h>
#include<conio.h>
static int i;
void Printf(int num)
{
int j;
scanf("%d",&j);
i++;
if(i<num)
Printf(num);
i--;
printf("%d ",j);
}
Int main()
{
int number;
printf("Enter,how many numbers do you want: ");
scanf("%d",&number);
Printf(number);
getch();
return 0;
}
Замена абсолютно любых слов местами (просто в программе цифорки нужные поменять) Где цифры жирные там менять по ситуации
#include<stdio.h>
#include<conio.h>
#include<malloc.h>
void GetStr(char*str,int size)
{
int i;
char c;
for(i=0;size>0&&(c=getche())!=13;size--,i++)
{
str[i]=c;
}
str[i]='\0';
}
void Revers(char *str,int l, int r)
{
while(l<r)
{
int temp=str[l];
str[l]=str[r];
str[r]=temp;
l++;
r--;
}
}
void GetPositions(char* str,int *l1,int *l2,int *r1,int *r2)
{
int counter1=0,counter2=0;
while(str[*l1]!='\0'&&counter1<1)
{
if(*r1>0)
*l1=(*r1)+1;
while(str[*l1]==32)
(*l1)++;
if(str[*l1]!='\0')
counter1++;
*r1=*l1;
while(str[(*r1)+1]!=32 && str[(*r1)+1]!='\0')
(*r1)++;
}
while(str[*l2]!='\0'&&counter2<2)
{
*l2=(*r2)+1;
while(str[*l2]==32)
(*l2)++;
if(str[*l2]!='\0')
counter2++;
*r2=*l2;
while(str[(*r2)+1]!=32 && str[(*r2)+1]!='\0')
(*r2)++;
}
}
void Change(char*str,int count1,int count2)
{
int i=0,j=0,k=0,l=0;
GetPositions( str,&i,&k,&j,&l);
Revers(str,i,l);
i=0;j=0;k=0;l=0;
GetPositions( str,&i,&k,&j,&l);
Revers(str,i,j);
Revers(str,k,l);
if(count2-count1>=2)
Revers(str,j+1,k-1);
}
Int main()
{
char *string;
int size;
printf("Enter how many symbols do you want: ");
scanf("%d",&size);
string=(char*)malloc(size*sizeof(char));
printf("Enter string: ");
GetStr(string,size);
Change(string,1,2);
printf("\n%s",string);
free(string);
getch();
return 0;
}
Из 10-ой СС в любую
#include<stdio.h>
#include<conio.h>
int ss;
char ms[200];
char znak='+';
