Arvutiteaduse instituut
  1. Kursused
  2. 2022/23 kevad
  3. Programmeerimine keeles C++ (LTAT.03.025)
EN
Logi sisse

Programmeerimine keeles C++ 2022/23 kevad

  • Pealeht
  • 1. Muutujad ja andmetüübid
  • 2. Keele põhikonstruktsioonid I
  • 3. Keele põhikonstruktsioonid II
  • 4. Funktsioonimallid, failitöötlus
  • 5. OOP I Klassid
  • 6. OOP II Pärilus ja polümorfism
  • 7. Kontrolltöö 1?

Seitsmendal nädalal toimub 1. kontrolltöö

7.1 1. kontrolltöö näide?
  • 9. Dünaamiline mäluhaldus II
  • 10. Klassimallid
  • 11. STL andmestruktuurid I
  • 12. STL andmestruktuurid II
  • 13. Erindite töötlemine
  • 14. Täiendavad teemad
  • 15. Kontrolltöö 2?

Viieteistkümnendal nädalal toimub 2. kontrolltöö

15.1 2. kontrolltöö näide?
  • 16. Projekti esitlus?
  • Viiteid
  • Home
  • Labs
    • Submission of solutions
    • Results
  • Examination times
  • Guides
  • References

Programming in C ++

Lab 1: Introduction to Language and Tools - Homework

General conditions

Important! Read the conditions for completing the assignments on the module's website! Tasks are submitted via the form on the module's website. Solutions will not be accepted via email. If you have any questions, please contact the internship supervisor. There are 14 days to solve the task.

Deadline 20.02.2022 23:59:59

Task 1 - More Features (4 points)

  1. Add the following features to the features file:
    1. maximum - finds the larger of the two integers
    2. product - multiplies two integers and returns the product as an integer
    3. power - raises the first integer to the power of the second integer (if the result is a fraction or infinity, for example, for some negative power, output zero)
    4. gcd - finds the greatest common divisor of the two integers (check that no input crashes)
  2. Complete the main program. The command line accepts two integers, and a function name can be specified. An error message must be issued for an incorrect number of parameters. The standard output must first output the two numbers from the command line, separated by a space, and then the result of a given function (separated by a newline). If the function was not specified, the results of all methods must be output (separated by a newline):
    1. smaller of two numbers
    2. greater of two numbers
    3. product of two numbers
    4. first number to the power of second number (see above)
    5. the largest common denominator of the two numbers

Sample output if the command line is program 42 2 minimum

42 2
2

Sample output if the command line is program 42 2

42 2
2
42
84
1764
2

Attention! The application should be able to perform tasks even with the wrong format input.

For example, zero can be used as the default input value.

Add the appropriate tests to the main test program.

Task 2 - Documentation (3 points)

Add Doxygen comments for all features. Functions, parameters and return values must be specified in the documentation. The Doxygen file, which is used to generate the documentation, must also be submitted. In order to create the Doxygen file the program doxywizard can be used (included in Doxygen). You should note that (at least in Windows) the wizard writes absolute path into the generated Doxyfile (C:\Username\Folder\..), while we require a relative path.

HTML documentation is sufficient. LaTeX is not required.

NB! The standard name for the Doxygen configuration file is Doxyfile. With a different name, nothing simply happens because @doxygen@ cannot find the doxy.conf file.

Task 3 - Makefile additions (3 points)

Add 3 more targets to Makefile

doc- executes Doxygen, which generates documentation to folder docs. clean - deletes object code, program files and documentation and nothing else. all- builds a program and creates documentation. If the rules for doc or build are changed then make all must also work in the same way (don’t copy, refer). If make is called on the command line, then only the program should be built (no documentation).

For help: http://www.cprogramming.com/tutorial/makefiles.html

Additional task - Input from a file (1 extra point)

Modify the program for the first task so that if only one parameter is specified on the command line, it is processed as a file name and the file is opened for reading. The first line of the file contains two numbers that must be used to perform the same operations as in the first task. If there is no file with this name, a message must be issued in the standard error stream and the program must be stopped. If the file does not contain the expected content, the program must be able to handle it.

Let the file yksjakaks.txt in the folder contain

1 2

Sample output of the command line program yksjakaks.txt:

1 2
1
2
2
1
1
  • Arvutiteaduse instituut
  • Loodus- ja täppisteaduste valdkond
  • Tartu Ülikool
Tehniliste probleemide või küsimuste korral kirjuta:

Kursuse sisu ja korralduslike küsimustega pöörduge kursuse korraldajate poole.
Õppematerjalide varalised autoriõigused kuuluvad Tartu Ülikoolile. Õppematerjalide kasutamine on lubatud autoriõiguse seaduses ettenähtud teose vaba kasutamise eesmärkidel ja tingimustel. Õppematerjalide kasutamisel on kasutaja kohustatud viitama õppematerjalide autorile.
Õppematerjalide kasutamine muudel eesmärkidel on lubatud ainult Tartu Ülikooli eelneval kirjalikul nõusolekul.
Courses’i keskkonna kasutustingimused