samedi 19 septembre 2020

C++ Why These Same Codes (i think) Giving Different Outputs?

I'm watching tutorial series for c++ from youtube channel Trevor Payne. https://youtu.be/iMbvbWlrMj8?list=PL82YdDfxhWsCyZLsg_kXhH8sy5ixQNras&t=657 In here his console starts counting from 1 to 10, While my code starts from 0. Why?

#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int main() {
    int i = 0;
    for (;;) {
        cout << i++ << endl;
        if (i > 10)
            break;
    }

    string y; 
    getline(cin, y);
    return(0);
}

Aucun commentaire:

Enregistrer un commentaire