yeah < > I had to switch gears,
Code:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
char snacks[7] [30] = { " ", "Cracker Jacks","Gummy Bears","Lemon Heads",
"Skittles","Snickers","Milky Way"};
vector < string > snackos =
{ " ", "Cracker Jacks","Gummy Bears","Lemon Heads",
"Skittles","Snickers","Milky Way"};
size_t count = 1, col = 0;
for ( ; count < 7 ; count++)
cout <<snackos[count]<<endl;
//same code compiled in C as well
//gets same output
printf("\ntime two\n"
"C code\n\n");
count = 1, col = 0;
for ( ; count < 7 ; count++)
{
for (; col != '\n'; col++)
{
printf("%c", snacks[count][col]);
}
printf("\n");
col = 0; //reset
}
return 0;
}
Originally Posted by
jimblumberg
By the way for someone who considers himself an expert your code contains quite a few beginner mistakes.
that is an assumption on your part, period.
go look at every post in here Not one time have I ever made that claim, that I am an expert nor to I consider myself an expert in programming.
I have actually set the record straight in one post for the record. and No I am not going to look for it.
Code:
$ ./temp
Cracker Jacks
Gummy Bears
Lemon Heads
Skittles
Snickers
Milky Way
time two
C code
Cracker Ja
Gummy Bear
Lemon Head
Skittles
Snickers
Milky Way