/*
CLASS 1
*/
class MyClass
{
MyClass();
~MyClass();
public:
void MyStringFunction(std::string val) { mystring = val; }
private:
std::string mystring;
};
MyClass::MyClass()
{
mystring = "Test";
}
MyClass::~MyClass() { }
/*
CLASS 2
*/
class OtherClass
{
OtherClass();
~OtherClass();
public:
void ChangeMyString() { }
};
OtherClass::OtherClass() { }
OtherClass::~OtherClass() { }
void OtherClass::ChangeMyString()
{
MyClass myClass = new MyClass();
myClass->MyStringFunction("Test Change");
}
Well thanks Tommy !
- - - Updated - - -
But what about that ?
C++ a function which outputs multiples of 5, excluding 15.
No problem
Can you help me to write an function which outputs multiples of five , excluding Fifteen
Like an c++ application.
which outputs multiples of five , excluding Fifteen
#include <cstdio>
int main()
{
int max=1000;
int i=1,result=0;
while(result!=max && i!=200)
{
result=5*i;
printf("\n %d",result);
i++;
}
std::getchar();
}
This will output multiples of 5 in console:
Code:#include <cstdio> int main() { int max=1000; int i=1,result=0; while(result!=max && i!=200) { result=5*i; printf("\n %d",result); i++; } std::getchar(); }
I'm not sure how to exclude '15' from the list, if that's what you're referring to..
#include <stdio.h>
int main()
{
int rs = 1;
for (int i = 0; ; i++)
{
rs = 5 * i;
if (rs == 15)
continue;
printf("%i\n", rs);
}
return 0;
}