ok so my program works perfectly but when I try to add a for loop so it turns 2500 times the program starts takes the value to be taken by user but it never ends!!"press any button..." never shows up whyyy??
Since you haven't posted your full code I can only guess, but cout puts anything want to output into a buffer and you have to flush that buffer in order to have it print something out. I don't think it will flush when you call system("pause");
You can flush it by using endl like this cout << dataholder.at(0) << endl;
Or if you don't want a newline, put cout.flush() after that statement.
@Gulshan Singh I dont think that the flow is even reaching that statement and that is the problem dcftci is trying to solve here.
@dcftci, there is nothing wrong in the loop per say, thats why I was doubting first.process(l,z); (except the return type of main should always be int and type of z, l should be float rather than int as process accepts/at least returns float)
I put the process function (which is a member of my class now) into main to see if there is something wrong with my codings but it worked perfectly turned the right value and still while a class member it turns the right value and it works if I dont ask it to do it for 2500 times
so thats why I thought the problem might be the for loop
I also defined z,l as float but nothing changed the program started but didn't end :( the black rectangle is still there :((
@codewalker I've had this similar problem before, and I also thought that it was because my code wasn't reaching the statement. But the actual problem was that the buffer wasn't being flushed. It's actually a really common problem for beginners. See http://www.cplusplus.com/reference/iostream/ostream/flush/
@Gulshan Singh thanks for the suggestion but I put "cout<<dataholder.at(0);"to check whether the vector is formed or not. my actual intention is to transport the data in the vector into a file but once I start the program using for loop it never stops
I tried your code that you posted it works with or without the loop.
Except instead of your class I replaced the class member process with a global process function, and other simple modifications such as signature of main.