First Upload
This commit is contained in:
BIN
10/תיעוד/Homework - 12/Debug/Homework - 12.exe
Normal file
BIN
10/תיעוד/Homework - 12/Debug/Homework - 12.exe
Normal file
Binary file not shown.
BIN
10/תיעוד/Homework - 12/Debug/Homework - 12.ilk
Normal file
BIN
10/תיעוד/Homework - 12/Debug/Homework - 12.ilk
Normal file
Binary file not shown.
BIN
10/תיעוד/Homework - 12/Debug/Homework - 12.pdb
Normal file
BIN
10/תיעוד/Homework - 12/Debug/Homework - 12.pdb
Normal file
Binary file not shown.
31
10/תיעוד/Homework - 12/Homework - 12.sln
Normal file
31
10/תיעוד/Homework - 12/Homework - 12.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.572
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework - 12", "Homework - 12\Homework - 12.vcxproj", "{ED24374E-80FE-4D58-84D3-CAA154075EB6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{ED24374E-80FE-4D58-84D3-CAA154075EB6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ED24374E-80FE-4D58-84D3-CAA154075EB6}.Debug|x64.Build.0 = Debug|x64
|
||||
{ED24374E-80FE-4D58-84D3-CAA154075EB6}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{ED24374E-80FE-4D58-84D3-CAA154075EB6}.Debug|x86.Build.0 = Debug|Win32
|
||||
{ED24374E-80FE-4D58-84D3-CAA154075EB6}.Release|x64.ActiveCfg = Release|x64
|
||||
{ED24374E-80FE-4D58-84D3-CAA154075EB6}.Release|x64.Build.0 = Release|x64
|
||||
{ED24374E-80FE-4D58-84D3-CAA154075EB6}.Release|x86.ActiveCfg = Release|Win32
|
||||
{ED24374E-80FE-4D58-84D3-CAA154075EB6}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5F88B4C9-0452-4A20-AC8A-93BC16D123B9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,5 @@
|
||||
hw.c
|
||||
c:\users\tal levin\desktop\college\c things\homework - 12\homework - 12\hw.c(220): warning C4047: 'initializing': 'char *' differs in levels of indirection from 'char (*)[100]'
|
||||
c:\users\tal levin\desktop\college\c things\homework - 12\homework - 12\hw.c(382): warning C4013: '_getch' undefined; assuming extern returning int
|
||||
c:\users\tal levin\desktop\college\c things\homework11pointer\homework11pointer\pointer.c(201): warning C4716: 'IsPerfect': must return a value
|
||||
Homework - 12.vcxproj -> C:\Users\Tal Levin\Desktop\College\C things\Homework - 12\Debug\Homework - 12.exe
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
|
||||
Debug|Win32|C:\Users\Tal Levin\Desktop\College\C things\Homework - 12\|
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/Pointer.obj
Normal file
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/Pointer.obj
Normal file
Binary file not shown.
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/hw.obj
Normal file
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/hw.obj
Normal file
Binary file not shown.
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/hw.obj.enc
Normal file
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/hw.obj.enc
Normal file
Binary file not shown.
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/vc141.idb
Normal file
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/vc141.idb
Normal file
Binary file not shown.
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/vc141.pdb
Normal file
BIN
10/תיעוד/Homework - 12/Homework - 12/Debug/vc141.pdb
Normal file
Binary file not shown.
123
10/תיעוד/Homework - 12/Homework - 12/Homework - 12.vcxproj
Normal file
123
10/תיעוד/Homework - 12/Homework - 12/Homework - 12.vcxproj
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{ED24374E-80FE-4D58-84D3-CAA154075EB6}</ProjectGuid>
|
||||
<RootNamespace>Homework12</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hw.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hw.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
383
10/תיעוד/Homework - 12/Homework - 12/hw.c
Normal file
383
10/תיעוד/Homework - 12/Homework - 12/hw.c
Normal file
@@ -0,0 +1,383 @@
|
||||
#pragma once
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <stdio.h>
|
||||
#include "C:\Users\Tal Levin\Desktop\College\C things\Homework11Pointer\Homework11Pointer\Pointer.c"
|
||||
#define Numbers 10
|
||||
#define Hundred 100
|
||||
#define Zero 0
|
||||
#define Ten 10
|
||||
#define One 1
|
||||
typedef char string[Hundred];
|
||||
void Nullify(char *string)
|
||||
{
|
||||
//sets the string to blanks
|
||||
short count = Zero;
|
||||
while (count < Hundred-One)
|
||||
{
|
||||
*(string + count) = ' ';
|
||||
count++;
|
||||
}
|
||||
*(string + count + One) = '\0';
|
||||
}
|
||||
char *itoa(int *num)
|
||||
{
|
||||
//turns int to char/string
|
||||
char *newString;
|
||||
char a[Hundred] = { Zero };
|
||||
newString = &a[Zero];
|
||||
int k = NumReversal(num);
|
||||
while(k>Zero)
|
||||
{
|
||||
*(newString++) = k % Ten + '0';
|
||||
k /= Ten;
|
||||
}
|
||||
*(++newString) = '\0';
|
||||
return &a[Zero];
|
||||
}
|
||||
int Length(char arr[])
|
||||
{
|
||||
//checks the length of a string
|
||||
int count = Zero;
|
||||
while (arr[count++]!='\0');
|
||||
return count-One;
|
||||
}
|
||||
int SubString(char *string, char *substring,
|
||||
char *new_string)
|
||||
{
|
||||
//checks how many times substring shows up in
|
||||
//main string and deletes them
|
||||
short len = Length(substring);
|
||||
short replaced = Zero;
|
||||
while (*(string))
|
||||
{
|
||||
short pos = 0;
|
||||
while (*(string + pos)!='\0'
|
||||
&& *(substring + pos)!='\0'
|
||||
&& *(string+pos) == *(substring+pos)
|
||||
&& pos < len)
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
if (pos == len)
|
||||
{
|
||||
string += len;
|
||||
replaced++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*new_string = *string;
|
||||
new_string++;
|
||||
string++;
|
||||
}
|
||||
}
|
||||
return replaced;
|
||||
}
|
||||
int HowManyTimes(char *string, char *substring)
|
||||
{
|
||||
//checks how many times substring shows up in
|
||||
//main string
|
||||
short len = Length(substring);
|
||||
short showups = Zero;
|
||||
while (*(string))
|
||||
{
|
||||
short pos = 0;
|
||||
while (*(string + pos) != '\0'
|
||||
&& *(substring + pos) != '\0'
|
||||
&& *(string + pos) == *(substring + pos)
|
||||
&& pos < len)
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
if (pos == len)
|
||||
{
|
||||
string += len;
|
||||
showups++;
|
||||
}
|
||||
else
|
||||
{
|
||||
string++;
|
||||
}
|
||||
}
|
||||
return showups;
|
||||
}
|
||||
short HowManySeqChars(char *str,char *frequent)
|
||||
{
|
||||
//checks which char appears the most and
|
||||
//how many times
|
||||
short max_count_chars = Zero;
|
||||
while (*str)
|
||||
{
|
||||
int count_chars = Zero;
|
||||
while (*(str + count_chars + One)
|
||||
&& *(str + count_chars) ==
|
||||
*(str + count_chars + One))
|
||||
{
|
||||
count_chars++;
|
||||
}
|
||||
if (count_chars > max_count_chars) {
|
||||
max_count_chars = count_chars;
|
||||
*frequent = *str;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
return max_count_chars + One;
|
||||
}
|
||||
void StringCut(char * string, char *even, char*odd)
|
||||
{
|
||||
//copies the even places to the even string
|
||||
//and the odd places to the odd string
|
||||
unsigned int counter = Zero;
|
||||
while (*(string + counter) != '\0')
|
||||
{
|
||||
if (counter % Two == Zero)
|
||||
{
|
||||
*even = *(string + counter);
|
||||
even++;
|
||||
counter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*odd = *(string + counter);
|
||||
odd++;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
*even = '\0';
|
||||
*odd = '\0';
|
||||
}
|
||||
Bool MemoyanLeserogin(char *even, char *odd)
|
||||
{
|
||||
//checks if even places are going down, and odd are going up
|
||||
int lengthEven = Length(even);
|
||||
int lengthOdd = Length(odd);
|
||||
Bool found = True;
|
||||
for (int counter = Zero; counter < lengthEven - One; counter++)
|
||||
{
|
||||
if (*(even + counter) > *(even + counter + One))
|
||||
{
|
||||
found = False;
|
||||
}
|
||||
|
||||
}
|
||||
for (int counter = Zero; counter < lengthOdd - One; counter++)
|
||||
{
|
||||
if (*(odd + counter) < *(odd + counter + One))
|
||||
{
|
||||
found = False;
|
||||
}
|
||||
|
||||
}
|
||||
return found;
|
||||
}
|
||||
Bool MemoyanLeserogin2(char *even, char*odd)
|
||||
{
|
||||
//checks if odd places are going down, and even are going up
|
||||
int lengthEven = Length(even);
|
||||
int lengthOdd = Length(odd);
|
||||
Bool found = True;
|
||||
for (int counter = Zero; counter < lengthEven - One; counter++)
|
||||
{
|
||||
if (*(even + counter) < *(even + counter + One))
|
||||
{
|
||||
found = False;
|
||||
}
|
||||
|
||||
}
|
||||
for (int counter = Zero; counter < lengthOdd - One; counter++)
|
||||
{
|
||||
if (*(odd + counter) > *(odd + counter + One))
|
||||
{
|
||||
found = False;
|
||||
}
|
||||
|
||||
}
|
||||
return found;
|
||||
}
|
||||
void isStringMemoyan(char* a, char * even, char*odd)
|
||||
{
|
||||
//This function checks if the string given
|
||||
//stands by the criteria of sorted string
|
||||
StringCut(a, even, odd);
|
||||
Bool check = MemoyanLeserogin(even, odd);
|
||||
Bool check1 = MemoyanLeserogin2(even, odd);
|
||||
if (check == One)
|
||||
{
|
||||
printf("Memuyan Le Serugin\n");
|
||||
}
|
||||
if (check1 == One)
|
||||
{
|
||||
printf("Memuyan Le Serugin Hafuh\n");
|
||||
}
|
||||
if(!check1 && !check)
|
||||
{
|
||||
printf("Lo Memuyan\n");
|
||||
}
|
||||
}
|
||||
int DeleteSameInstances(char *string, char *sub,char *new_s)
|
||||
{
|
||||
//deletes all the same words of the second string from the first
|
||||
char str[Hundred];
|
||||
char *temp = &str;
|
||||
int count = Zero;
|
||||
*temp = '\0';
|
||||
while (*(sub-One) != '\0')
|
||||
{
|
||||
Cut(sub, temp);
|
||||
count += SubString(string,temp,new_s);
|
||||
Copy(string,new_s);
|
||||
sub += Length(temp)+One;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
/*
|
||||
//-----------------------------------------------------------------
|
||||
// exe 1
|
||||
// -----
|
||||
// General : the program goes over the string and checks how many
|
||||
// appearences the substring makes
|
||||
// Input : a string and a word/sub-string to search for
|
||||
// Process : the program takes the sub-string and checks if the
|
||||
// string has the same sequence of chars in it.
|
||||
// Output : The times it has shown up in the string
|
||||
//-----------------------------------------------------------------
|
||||
// Proggramer : Tal Levin
|
||||
// Student No : 212204176
|
||||
// Date : 12.11.19
|
||||
//-----------------------------------------------------------------
|
||||
void main()
|
||||
{
|
||||
string str1;
|
||||
string str2;
|
||||
char *origin = &str1[Zero];
|
||||
char *sub = &str2[Zero];
|
||||
Nullify(origin);
|
||||
Nullify(sub);
|
||||
printf("Enter source string: ");
|
||||
scanf("%[^\n]%*c", str1);
|
||||
printf("Enter replace string: ");
|
||||
scanf("%[^\n]%*c", str2);
|
||||
short count = HowManyTimes(origin, sub);
|
||||
printf("Number of times: %hd\n", count);
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// exe 2
|
||||
// -----
|
||||
// General : the program checks which char repeats itself the most
|
||||
// in a string and shows how many times it shows up
|
||||
// Input : a string
|
||||
// Process : goes over every letter and checks the amount of it
|
||||
// Output : the highest repeating char and the times it appeared
|
||||
// in string.
|
||||
//-----------------------------------------------------------------
|
||||
// Proggramer : Tal Levin
|
||||
// Student No : 212204176
|
||||
// Date : 12.11.19
|
||||
//-----------------------------------------------------------------
|
||||
void main()
|
||||
{
|
||||
string arr;
|
||||
char f;
|
||||
short count = Zero;
|
||||
char *frequent = &f;
|
||||
char *str = &arr[Zero];
|
||||
printf("Enter string: ");
|
||||
scanf("%[^\n]%*c", str);
|
||||
count = HowManySeqChars(str, frequent);
|
||||
printf("the most frequent letter: %c \n", *frequent);
|
||||
printf("anount of times in: %hd", count);
|
||||
_getch();
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// exe 3
|
||||
// -----
|
||||
// General : the program checks if the string is ordered by the
|
||||
// given standard
|
||||
// Input : a string
|
||||
// Process : goes over every even and odd space and checks if it
|
||||
// falls under the criteria of a sorted string
|
||||
// Output : if it is a sorted string or not and what type
|
||||
//-----------------------------------------------------------------
|
||||
// Proggramer : Tal Levin
|
||||
// Student No : 212204176
|
||||
// Date : 12.11.19
|
||||
//-----------------------------------------------------------------
|
||||
void main()
|
||||
{
|
||||
string arr;
|
||||
char *str = &arr[Zero];
|
||||
string arr1;
|
||||
char *str1 = &arr1[Zero];
|
||||
string arr2;
|
||||
char *str2 = &arr2[Zero];
|
||||
printf("Enter string: ");
|
||||
scanf("%[^\n]%*c", str);
|
||||
isStringMemoyan(str, str1, str2);
|
||||
_getch();
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// exe 4
|
||||
// -----
|
||||
// General : the program turns a num into string
|
||||
// Input : a num
|
||||
// Process : the program takes each number and adds the value in
|
||||
// computer code of '0' to it, to turn it to a char
|
||||
// Output : the num as a string
|
||||
//-----------------------------------------------------------------
|
||||
// Proggramer : Tal Levin
|
||||
// Student No : 212204176
|
||||
// Date : 12.11.19
|
||||
//-----------------------------------------------------------------
|
||||
void main(void)
|
||||
{
|
||||
char *converted;
|
||||
char b[Hundred];
|
||||
converted = &b[Zero];
|
||||
Nullify(converted);
|
||||
int *num;
|
||||
int toconvert = 2103;
|
||||
num = &toconvert;
|
||||
converted = itoa(num);
|
||||
_getch();
|
||||
}
|
||||
*/
|
||||
//-----------------------------------------------------------------
|
||||
// exe 5
|
||||
// -----
|
||||
// General : the program takes out all the appearnces of a word,
|
||||
// from another string
|
||||
// Input : two strings
|
||||
// Process : goes over each word in the second string, and deletes
|
||||
// the words that appear from the first one
|
||||
// Output : the original string, the second string, new string, and
|
||||
// amount of changes made.
|
||||
//-----------------------------------------------------------------
|
||||
// Proggramer : Tal Levin
|
||||
// Student No : 212204176
|
||||
// Date : 12.11.19
|
||||
//-----------------------------------------------------------------
|
||||
void main()
|
||||
{
|
||||
string str1;
|
||||
string str2;
|
||||
string str3;
|
||||
string str4;
|
||||
char *s = &str1[Zero];
|
||||
char *sub = &str2[Zero];
|
||||
char *new_s = &str3[Zero];
|
||||
char *origin = &str4[Zero];
|
||||
Nullify(s);
|
||||
Nullify(sub);
|
||||
Nullify(new_s);
|
||||
printf("Enter source string: ");
|
||||
scanf("%[^\n]%*c", s);
|
||||
printf("Enter replace string: ");
|
||||
scanf("%[^\n]%*c", sub);
|
||||
Copy(origin, s);
|
||||
int changes = DeleteSameInstances(s, sub, new_s);
|
||||
printf("Origin String: %s\n",origin);
|
||||
printf("Sub string: %s\n", sub);
|
||||
printf("New string: %s\n",new_s);
|
||||
printf("Number of changes: %hd\n", changes);
|
||||
_getch();
|
||||
}
|
||||
Reference in New Issue
Block a user