Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,195,349 members, 7,957,928 topics. Date: Wednesday, 25 September 2024 at 02:57 AM

C++: This Tiny Thing Is Still Puzzlin Me. Here Is My Code - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / C++: This Tiny Thing Is Still Puzzlin Me. Here Is My Code (1089 Views)

Please Help Look At My Code (what is wrong with my code ) / Help!! I Need A Laptop To Run My Code!!! / Php Gurus Help Me Out: What Is Wrong With My Code?? (2) (3) (4)

(1) (Reply) (Go Down)

C++: This Tiny Thing Is Still Puzzlin Me. Here Is My Code by badthinds: 8:12pm On Jul 04, 2016
Its been a while i used c++. Today I was trying to write a python file usin' c++, this is my code, everything seem correct, but it dosnt compile. I've written files using this method but this one Don hook ma neck. Programmers in the house what's wrong. Thanks.



#include <iostream>
#include <string>
#include <fstream>
#define NL '\n'

using namespace std;
int main()
{
....ofsream myfile;
....myfile.open("C:/python33/junk/max_ranker.py" );
\
....myfile << "\
....animals = ['ortom', 'suswam', 'akume']\
....//just for example
….position = 1;\
....for i in range(len(animals)):\
. . . . .highest = max (animals);\
. . . . .access = list.index(highest);\
. . . . .print(position, ": ", animals[access];\
. . . . .del animals[access];\
. . . . .position += 1;\
. . . . ."

....myfile.close();
system("PAUSE" );
return EXIT_SUCCESS;
}

________________________________

I use dev-c++ editor / compiler
Re: C++: This Tiny Thing Is Still Puzzlin Me. Here Is My Code by dueal(m): 11:25pm On Jul 04, 2016
Escape ur double quotes in string and close main string double quote and dont forget d semicolon for end of statement.

1 Like

Re: C++: This Tiny Thing Is Still Puzzlin Me. Here Is My Code by codemarshal08(m): 5:38am On Jul 05, 2016
#include <iostream>
#include <string>
#include <fstream>
#define NL '\n'

using namespace std;
int main()
{
....ofsream ofstream myfile;
........

NB : you can make the work less tedious for us by providing the errors messages!

1 Like

Re: C++: This Tiny Thing Is Still Puzzlin Me. Here Is My Code by badthinds: 10:18am On Jul 05, 2016
Oh thanks everyone... I've fixed it. Now I understand the programmer hide and seek champion ( ; ) joke. tws the missing trailing comma at the end of the string myfile. Not my fault, it's too much python. grin

(1) (Reply)

***showcase & Promote Ur Apps Free & Become Popular App Developers / Error Positioning In File / For Girls Only

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.