Jump to content
  • Advertisement
Sign in to follow this  
supercrazy7474

cout error??(c++)

This topic is 5108 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Uh... How are these three couts having error?(the variables have been declared,yes.) cout<<xando[0]<<xando[1]<<xando[2]<<endl;<<xando[3]<<xando[4]<<xando[5]<<endl;<<xando[6]<<xando[7]<<xando[8]<<endl;<<endl;<<endl; cout<<xando[0]<<xando[1]<<xando[2]<<endl;<<xando[3]<<xando[4]<<xando[5]<<endl;<<xando[6]<<xando[7]<<xando[8]<<endl;<<endl;<<endl; cout<<xando[0]<<" has won!";<<endl;

Share this post


Link to post
Share on other sites
Advertisement
You have extra ;'s in the middle of your statements. Get rid of the ;'s after all but the last endl on each line.

Share this post


Link to post
Share on other sites
Quote:
Original post by supercrazy7474
Uh... How are these three couts having error?(the variables have been declared,yes.)

cout<<xando[0]<<xando[1]<<xando[2]<<endl;<<xando[3]<<xando[4]<<xando[5]<<endl;<<xando[6]<<xando[7]<<xando[8]<<endl;<<endl;<<endl;

cout<<xando[0]<<xando[1]<<xando[2]<<endl;<<xando[3]<<xando[4]<<xando[5]<<endl;<<xando[6]<<xando[7]<<xando[8]<<endl;<<endl;<<endl;

cout<<xando[0]<<" has won!";<<endl;


dear lord, tidy that up


#include <cstddef>
#include <algorithm>
#include <iterator>
#include <iostream>

int main() {


const int foo[] = { 3, 4, 5, 6, 345, 54 };

const size_t N = sizeof(foo) / sizeof(int);

std::copy(foo, foo + N, std::ostream_iterator<int>(std::cout, ", "));

}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!