Commit 8877757d by Szeberényi Imre

Lab 01

parents
Gratulálok!
Önnek sikerült beolvasnia ezt a fájlt az SVN tárolóból.
Próbálja ki, hogyan tudja átteni a saját tárolrójába!
Sok sikert:
Szeberényi Imre
PS:
Ez a változat UTF-8 kódolású
Az ural2-n au UTF-8 beállításához adja ki a következő parancsot:
LANG=en_US.UTF-8
Természetesen a putty beállításának is UTF-8 kódolásónak kell lennie.
(wiondow->translation)
Ha ISO-8859-1-es kódolást szeretne, akkor
LANG=iso_8859_1
értéket kell beállítania
#
# Demo Makefile a nagyobb program eloallitasahoz
#
PROG = nagyobb
SRCS = nagyobb_main.cpp fuggvenyeim.cpp
HDRS = fuggvenyeim.h
OBJS = $(SRCS:.cpp=.o)
CXXFLAGS = -g -Wall
$(PROG): $(OBJS)
$(CXX) -o $(PROG) $(OBJS)
.PHONY:
clean:
rm -f $(OBJS) $(PROG)
# Egyszerusites: Minden .o fugg minden header-tol
$(OBJS): $(HDRS)
// Fjl: fuggvenyeim.cpp
// Ebben valstom meg a gyakran hasznlt fggvnyeket.
#include "fuggvenyeim.h"
// Kt int adat felcserlse
void csere(int& a, int& b) {
int tmp = a;
a = b;
b = tmp;
}
// ....
// Fjl: fuggvenyeim.cpp
// Ebben tallhatk a fggvnyek prototpusai,
// tpusok, konstansok, egyb deklarcik
#ifndef FUGGVENYEIM_H
#define FUGGVENYEIM_H
/*
* csere
* Kt int adat felcserlse
* @param a - egyik adat
* @param b - msik adat
*/
void csere(int& a, int& b);
/*
* max
* Kt int adat kzl a nagyobb
* @param a - egyik adat
* @param b - msik adat
*/
// Ez egy inline fggvny, amit minden fordtsi
// egysgben definilni kell.
inline int max(int a, int b) { return a > b ? a : b; }
#endif // FUGGVENYEIM_H
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="if" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/if" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/if" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="fuggvenyeim.cpp" />
<Unit filename="fuggvenyeim.h" />
<Unit filename="nagyobb_main.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nagyobb", "nagyobb.vcxproj", "{771497AB-BC58-46A4-96A3-5200F8C2EFF5}"
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
{771497AB-BC58-46A4-96A3-5200F8C2EFF5}.Debug|x64.ActiveCfg = Debug|x64
{771497AB-BC58-46A4-96A3-5200F8C2EFF5}.Debug|x64.Build.0 = Debug|x64
{771497AB-BC58-46A4-96A3-5200F8C2EFF5}.Debug|x86.ActiveCfg = Debug|Win32
{771497AB-BC58-46A4-96A3-5200F8C2EFF5}.Debug|x86.Build.0 = Debug|Win32
{771497AB-BC58-46A4-96A3-5200F8C2EFF5}.Release|x64.ActiveCfg = Release|x64
{771497AB-BC58-46A4-96A3-5200F8C2EFF5}.Release|x64.Build.0 = Release|x64
{771497AB-BC58-46A4-96A3-5200F8C2EFF5}.Release|x86.ActiveCfg = Release|Win32
{771497AB-BC58-46A4-96A3-5200F8C2EFF5}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {43E7D6B0-6442-4F99-AC42-5DF9DBB44C7B}
EndGlobalSection
EndGlobal
<?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>{771497AB-BC58-46A4-96A3-5200F8C2EFF5}</ProjectGuid>
<WindowsTargetPlatformVersion>10.0.16299.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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
</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'">
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="fuggvenyeim.cpp" />
<ClCompile Include="nagyobb_main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="fuggvenyeim.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
// Fjl: nagyobb_main.cpp
// Egyszer demo program.
// Bekr kt egsz szmot s kirja a nagyobbat.
#include <iostream>
#include "fuggvenyeim.h"
using namespace std;
int main() {
cout << "Kerek ket egesz szamot:";
int i, j;
cin >> i >> j; // i s j rtknek beolvassa
int k = max(i, j);
cout << "A nagyobb: " << k << endl; // nagyobb kirsa
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment