S
ssmile03
All,
Need HELP for below wrong output -
---
#include <iostream>
#include <sstream> // for ostringstream
#include <string>
using namespace std;
int main()
{
std::string name = "HELP";
string age = "01";
int count[10];
for (int x = 0; x < 5; x++) {
int result = 5;
result += count[x];
std:stringstream out;
out << "The value is .." << name << age << result;
std::cout << out.str() << endl;
}
return 0;
}
--
The output is as -
The value is ..HELP012
The value is ..HELP011
The value is ..HELP014198113
The value is ..HELP011
The value is ..HELP011
while the required output should be -
The value is ..HELP011
The value is ..HELP012
The value is ..HELP013
The value is ..HELP014
The value is ..HELP015
Thanks!!
Need HELP for below wrong output -
---
#include <iostream>
#include <sstream> // for ostringstream
#include <string>
using namespace std;
int main()
{
std::string name = "HELP";
string age = "01";
int count[10];
for (int x = 0; x < 5; x++) {
int result = 5;
result += count[x];
std:stringstream out;
out << "The value is .." << name << age << result;
std::cout << out.str() << endl;
}
return 0;
}
--
The output is as -
The value is ..HELP012
The value is ..HELP011
The value is ..HELP014198113
The value is ..HELP011
The value is ..HELP011
while the required output should be -
The value is ..HELP011
The value is ..HELP012
The value is ..HELP013
The value is ..HELP014
The value is ..HELP015
Thanks!!