Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. New to C++ and Programming, Absolutely new

New to C++ and Programming, Absolutely new

Scheduled Pinned Locked Moved C / C++ / MFC
c++regexquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11731193
    wrote on last edited by
    #1

    Hello eeryone, I am Mark, am attending Foothill College in SOCAL and I am cmpletely new to all of this. I am having trouble with my first assignment, I will show you. I am on DEV C++ : #include using namespace std; int main() { cout<< "Tran says this is her first computer program."; } { ----------------------------------------- intmain() cout<< "Tran says that."; cout<< "this is her first computer program."; cout<< "Tran says this is her first computer program."; cout<< "Tran says that,"; cout<< "this is her first computer program."; cout<< "Tran said that, "This is my first computer program.""; cout<< "Train said that,."; cout<< ""this is my first computer program.""; cout<< "Tran said that,."; ""this is my first computer program.""; cout<< "Tran said that."; cout<< ""this is my first computer program.""; } This is what My teacher said : Hi Mark, You can only have "int main()" once in your program. Once you put the close curly brace to end it, you can't have any more code below that. If you take another look through the lesson and the textbook reading, you'll see that all of the examples follow that pattern. The solution is to put all of the cout statements inside the first set of curly braces, so you don't need any additional curly braces. Dave Now, I did this here and this is what happened : #include using namespace std; int main() { cout<< "Tran says this is her first computer program."; cout<< "Tran says that."; cout<< "this is her first computer program."; cout<< "Tran says this is her first computer program."; cout<< "Tran says that,"; cout<< "this is her first computer program."; cout<< "Tran said that, "This is my first computer program.""; cout<< "Train said that,."; cout<< ""this is my first computer program.""; cout<< "Tran said that,."; ""this is my first computer program.""; cout<< "Tran said that."; cout<< ""this is my first computer program.""; } This is what my computer said : ( I want to post the Pic, I cannot copy and paste it down.Can somone show me how topost pics on here ? Thanks, If I cannot then I will privately email you. ) So I did what the teacher said to do and then I compile and got more lines all messed up. I am confused... Thanks

    A T 2 Replies Last reply
    0
    • U User 11731193

      Hello eeryone, I am Mark, am attending Foothill College in SOCAL and I am cmpletely new to all of this. I am having trouble with my first assignment, I will show you. I am on DEV C++ : #include using namespace std; int main() { cout<< "Tran says this is her first computer program."; } { ----------------------------------------- intmain() cout<< "Tran says that."; cout<< "this is her first computer program."; cout<< "Tran says this is her first computer program."; cout<< "Tran says that,"; cout<< "this is her first computer program."; cout<< "Tran said that, "This is my first computer program.""; cout<< "Train said that,."; cout<< ""this is my first computer program.""; cout<< "Tran said that,."; ""this is my first computer program.""; cout<< "Tran said that."; cout<< ""this is my first computer program.""; } This is what My teacher said : Hi Mark, You can only have "int main()" once in your program. Once you put the close curly brace to end it, you can't have any more code below that. If you take another look through the lesson and the textbook reading, you'll see that all of the examples follow that pattern. The solution is to put all of the cout statements inside the first set of curly braces, so you don't need any additional curly braces. Dave Now, I did this here and this is what happened : #include using namespace std; int main() { cout<< "Tran says this is her first computer program."; cout<< "Tran says that."; cout<< "this is her first computer program."; cout<< "Tran says this is her first computer program."; cout<< "Tran says that,"; cout<< "this is her first computer program."; cout<< "Tran said that, "This is my first computer program.""; cout<< "Train said that,."; cout<< ""this is my first computer program.""; cout<< "Tran said that,."; ""this is my first computer program.""; cout<< "Tran said that."; cout<< ""this is my first computer program.""; } This is what my computer said : ( I want to post the Pic, I cannot copy and paste it down.Can somone show me how topost pics on here ? Thanks, If I cannot then I will privately email you. ) So I did what the teacher said to do and then I compile and got more lines all messed up. I am confused... Thanks

      A Offline
      A Offline
      Amarnath S
      wrote on last edited by
      #2

      Start simple. First have only one statement within main():

      #include
      using namespace std;

      int main()
      {
      cout << "Tran says this is her first computer statement." << endl;
      return 0;
      }

      The above is the complete program. No other statements above and below these. Then, upgrade the program to have two statements:

      #include
      using namespace std;

      int main()
      {
      cout << "Tran says this is her first computer statement." << endl;
      cout << "Tran says this is her second computer statement." << endl;
      return 0;
      }

      And then, go on progressively increasing the complexity. Some compilers need the return 0 statement since your main is returning int.

      U 1 Reply Last reply
      0
      • A Amarnath S

        Start simple. First have only one statement within main():

        #include
        using namespace std;

        int main()
        {
        cout << "Tran says this is her first computer statement." << endl;
        return 0;
        }

        The above is the complete program. No other statements above and below these. Then, upgrade the program to have two statements:

        #include
        using namespace std;

        int main()
        {
        cout << "Tran says this is her first computer statement." << endl;
        cout << "Tran says this is her second computer statement." << endl;
        return 0;
        }

        And then, go on progressively increasing the complexity. Some compilers need the return 0 statement since your main is returning int.

        U Offline
        U Offline
        User 11731193
        wrote on last edited by
        #3

        I get it, lets try that. Nope it still wont compile.. Ill keep in touch and sow the tutor tommorow. Thanks

        L 1 Reply Last reply
        0
        • U User 11731193

          I get it, lets try that. Nope it still wont compile.. Ill keep in touch and sow the tutor tommorow. Thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Looking at the actual source code in your question you have:

          #include
          using namespace std;
          int main()
          ...

          But the #include statement is incomplete. You must use that statement to include header files which define the various external classes/methods/functions etc, that you wish to use in your program. So, to use the cout command, you must include the header that defines the basic I/O stream classes thus:

          #include

          See https://msdn.microsoft.com/en-us/library/zh80x809(v=vs.100).aspx[^] for more details.

          1 Reply Last reply
          0
          • U User 11731193

            Hello eeryone, I am Mark, am attending Foothill College in SOCAL and I am cmpletely new to all of this. I am having trouble with my first assignment, I will show you. I am on DEV C++ : #include using namespace std; int main() { cout<< "Tran says this is her first computer program."; } { ----------------------------------------- intmain() cout<< "Tran says that."; cout<< "this is her first computer program."; cout<< "Tran says this is her first computer program."; cout<< "Tran says that,"; cout<< "this is her first computer program."; cout<< "Tran said that, "This is my first computer program.""; cout<< "Train said that,."; cout<< ""this is my first computer program.""; cout<< "Tran said that,."; ""this is my first computer program.""; cout<< "Tran said that."; cout<< ""this is my first computer program.""; } This is what My teacher said : Hi Mark, You can only have "int main()" once in your program. Once you put the close curly brace to end it, you can't have any more code below that. If you take another look through the lesson and the textbook reading, you'll see that all of the examples follow that pattern. The solution is to put all of the cout statements inside the first set of curly braces, so you don't need any additional curly braces. Dave Now, I did this here and this is what happened : #include using namespace std; int main() { cout<< "Tran says this is her first computer program."; cout<< "Tran says that."; cout<< "this is her first computer program."; cout<< "Tran says this is her first computer program."; cout<< "Tran says that,"; cout<< "this is her first computer program."; cout<< "Tran said that, "This is my first computer program.""; cout<< "Train said that,."; cout<< ""this is my first computer program.""; cout<< "Tran said that,."; ""this is my first computer program.""; cout<< "Tran said that."; cout<< ""this is my first computer program.""; } This is what my computer said : ( I want to post the Pic, I cannot copy and paste it down.Can somone show me how topost pics on here ? Thanks, If I cannot then I will privately email you. ) So I did what the teacher said to do and then I compile and got more lines all messed up. I am confused... Thanks

            T Offline
            T Offline
            Taulie
            wrote on last edited by
            #5

            please post the result or nobody can help you.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups