the code should look like this:
#include <iostream>using namespace std;int main(){cout <<"hello world";system("pause");return 0;}
don't you have a book you can look at??
#include <iostream>using namespace std;int main(){cout <<"hello world";system("pause");return 0;}
/* [GameDevExamples\TestCounter\TestCounter.cpp] * * Autogenerated with k2_Doc2Code tool. * * Description: * Simple counting program. */#include <iostream>int main(){ int minValue = 0; int maxValue = 0; std::cout << "Enter minimum value and maximum value: " << std::endl; std::cin >> minValue >> maxValue; std::cout << "Counting from [" << minValue << "] to [" << maxValue << "]:" << std::endl; for (int i = minValue; i <= maxValue; i++) { std::cout << "Current value: " << i << std::endl; } return 0;}
Quote:Enter minimum value and maximum value:
4 13
Counting from [4] to [13]:
Current value: 4
Current value: 5
Current value: 6
Current value: 7
Current value: 8
Current value: 9
Current value: 10
Current value: 11
Current value: 12
Current value: 13
Press any key to continue
Quote:Original post by C_Programmer0101
This code shows only this on my screen: Press any key to continue............
#include <stdlib.h>
#include <iostream>
using namespace std;
int main()
int min=0, max=0, i=0;
cout << "Input your first number to count from: ";
cout << "Input your last number to count to: ";
"
cin >> max;
for(i=min; i <= max; i++)
{
cout << i << endl;
}
system("pause");
return 0;
}
Very weird considering the program skips conditions on the for loop. Now my question is how do I stop it from doing that.
#include <stdlib.h>#include <iostream>using namespace std; int main(int argc, char** argc) {int min, max; cout << "Input your first number to count from: ";cin >> min;cout << "Input your last number to count to: ";cin >> max; //Note: You don't actually need an i variable, you could just use min, since you won't be needing its value againfor(int i = min; i <= max; i++) { cout << i << endl;}system("pause");return 0;}