Кас сделать волну нарастающей

  • Автор темы Gunik
  • Дата начала
G

Gunik

#1
Ребят, я дико извиняюсь, если такая тема уже была, но мне поиск не дает че то ничего

не подскажите как в С++ сделать волну из треугольников нарастающей, пишу прогу а у меня треуголники одинаковые получаются. Помогите плиз завтар сдавать работу а у меня ничего нету

вот задание:
1. Write a C++ program using functions which produces a series of triangles pointing to the
right, drawn with a keyboard character such as the *, which, when the program runs, will
imitate 'waves'. The program should allow the user to specify the size of the waves to be
drawn and how many waves are to be drawn altogether.
The user should also be able to specify if the wave size stays the same or gets bigger and
bigger (see example output below).
Example of waves getting bigger and bigger:
*
**
*
*
**
***
**
*
*
**
***
****
***
**
*
and so on+

2.
Write a C++ program which enables the user to calculate their monthly mobile phone
bill. Assume a current rate of 15p per minute. The user should be able to type in the total
number of minutes used and the program would then calculate the total billed amount.
Include a calculation of discounts based on the number of minutes. The discount levels
could be, for instance, up to 100 minutes used gives no refund, between 100 and 200
minutes give a 5% refund, between 200 and 400 minutes give a 10% discount and over
400 minutes give a 15% discount - or whatever figures you see fit to impose -- it is your
phone company!


первую часть сделала
C++:
#include <iostream>
using namespace std;
void print_triangle (int size);
void print_inverted_triangle (int size);

void print_triangle (int size)
{
for (int i = 1; i <= size; i++)
{
for (int x = 1; x<= i; x++)
cout << "*";
cout << endl;
}
}

void print_inverted_triangle (int size)
{
for (int n=size; n>=1; n--)
{
for (int y=1; y<=n; y++)
cout << "*";
cout << endl;
}
}
int main ()
{
int size, quantaty, s;
cout <<"Please define the size of your triangle " << endl;
cin >>size;
cout << "How many triangles you would like to see? " << endl;
cin >>quantaty;
{
for(int i=1;i<=quantaty;i++)
{
print_triangle (size); 
print_inverted_triangle (size);
}
}
return 0;
}

получились как бы одинковые треуголиник а как сделать нарастающими?