После запуска кода
Код: Выделить всё
#include
#include
#include
using namespace std;
int returnN(string s, int n)
{
int newN = n % s.size();
return newN;
}
int returnN2(string s, int n)
{
int a = s.size();
int newN = n % a;
return newN;
}
int main(void)
{
string text2 = "Hello World!";
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79088245/c-modulo-returning-inconsistent-results[/url]
Мобильная версия