Please support our C++ advertiser: Programming Forums
![]() |
•
•
•
•
Originally Posted by RobinA
ok i fixed it now but got one more question (heres the final code i used) when i click run the program it opens but it closes itself in about 0.01 sec after it have opened. whats the wrong now with the code, and i dont get any errors when compiling.
# include <iostream>
int main()
{
using namespace std;
int tal1, tal2, produkt;
tal1=5;
tal2=11;
produkt=tal1*tal2;
cout <<"Produkten är" << produkt;
}
I am a total newbie to c++ myself however i THINK its something like:
# include <iostream>
using namespace std;
int main()
{
int tal1, tal2, produkt;
tal1=5;
tal2=11;
produkt=tal1*tal2;
cout <<"Produkten är" << produkt;
cin >> mong;
return 0;
}Basically it ends because it reached the end of the program, if you add an input to the end then the program isnt finished till you do the input.
I have not tested this and have no idea if it works, like i said im a c++ newbie too :o
YoungCoder
Class Info:
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
Yea,using #include <iostream> is now the latest standard.
namespaces are something like a sealed off area of code,out side which you can use the same names with out conflicting with the name in the namespace scope.
You can also access namespace vars like namespace::std, std::cout
Have fun,ALSO learn to use the Standard Template Library (STL)
namespaces are something like a sealed off area of code,out side which you can use the same names with out conflicting with the name in the namespace scope.
You can also access namespace vars like namespace::std, std::cout
Have fun,ALSO learn to use the Standard Template Library (STL)
![]() |
Other Threads in the C++ Forum
- Previous Thread: Sending and receiving ARP packets
- Next Thread: sorting stl::map
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





then it worked like mine it opened and closed.
Linear Mode