| | |
New to C++, need help
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
•
•
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;
}
C++ Syntax (Toggle Plain Text)
# 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
Views: 3526 | Replies: 14
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays based beginner binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort sorting spoonfeeding string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






then it worked like mine it opened and closed.