when i runned my program i run into somekind of error. it compiled program, but when runned i started to getl oads and laods of errors. Can somone help me to fix these errors.
out of bound i cna fix by makeing the array bit ibgger. and line 11 i just needed it cause there is no value i want ot osend there i just need to call the function, so taht it would go through my array and formatt every member in there.
i get these 2 errors:
Error 1 error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(const std::basic_string<_Elem,_Traits,_Ax> &)' : cannot convert parameter 1 from 'int' to 'const std::basic_string<_Elem,_Traits,_Ax> &' c:\users\...\desktop\c++\39\projekt\projekt\main.cpp 68
2 IntelliSense: no suitable constructor exists to convert from "int" to "std::basic_string<char, std::char_traits<char>, std::allocator<char>>" c:\users\...\desktop\c++\39\projekt\projekt\main.cpp 68
first 70 fibonacci numbers, writes em into array, then formats the numbers so that the output woud be 43,546,464,546 not 43546464546 and then prints all 70 fibonacci numbers in array.
You are doing it a very odd way, however, the problem is the stringstream. In your loop you never clear the contents of it, so you jest keep adding number to it. Move line 9 [stringstream l;] to inside the while loop.
i was told to manipulet the origial code not to write enirely new.
I believe that your current path is a little off track. If this is homework it might be worth just checking you are on the correct path. If you want post the original code and assignment.
i moved stringstream l into while loop, i stlee get endles amountso f numbers.
In that case you also have a problem in output_formatted_string()
fibo() still dose not calculate the correct number, temp1 should be 0 (zero) and temp2 should be 1 (one).
To satisfy yourself that the looping number problem is in output_formatted_string(), comment out the call to it at the end of fibo() build and run the program.
I don't have the time at the moment to look at output_formatted_string() to work out what you are trying to do but from a quick look it seems that you are not clearing the stringstream and just keep adding number to it.