To modify the program to calculate the perimeter of a circle or triangle, you would need to add additional cases to the switch statement. Each case would include the necessary input prompts and formulas to calculate the perimeter based on the given dimensions. You can use the formulas 2 * 3.14159 * radius for the perimeter of a circle and base + height + hypotenuse for the perimeter of a triangle, where the hypotenuse can be calculated using the Pythagorean theorem.